Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can I run JAVA code with CodeRunner? #108

Closed
seiferthan opened this issue May 3, 2017 · 4 comments
Closed

how can I run JAVA code with CodeRunner? #108

seiferthan opened this issue May 3, 2017 · 4 comments
Labels

Comments

@seiferthan
Copy link

seiferthan commented May 3, 2017

Dear all:

I have installed JDK, VSC, and CodeRunner(btw, I have already set the path for JAVA correctly). However, when I try to use CodeRunner, there is always a same error message express: "error: class learn1 is public, should be declared in a file named learn1.java", and please see the picture below.

I am very sure that I named the class which is same as the file name.

http://imgur.com/m52uJua

the whole message is:

[Running] cd "d:\Dropbox\coding\practices\JAVA\src" && javac temp-msvqqxjdsd.java && java temp-msvqqxjdsd
temp-msvqqxjdsd.java:1: error: class learn1 is public, should be declared in a file named learn1.java
public class learn1 {
^
1 error
[Done] exited with code=1 in 5.295 seconds

I can use the Eclipse Neon for JAVA EE to compile can run the same file correctly. Do I need to setup anything before I use the feature in VSC? VSC is very cool and light, and I really want to use it to learn developing JAVA application. Please help me to figure out this problem. Thank you so much!

@formulahendry
Copy link
Owner

Hi @seiferthan , I see you have selected the code. Please do not select the code snippet and try again.

@formulahendry
Copy link
Owner

Or, you could use below setting (File->Preference->Settings) to avoid the impact of selection:

{
    "code-runner.ignoreSelection": true
}

@seiferthan
Copy link
Author

@formulahendry
Thank you!!! Your are awesome! I tried to fined the solution for two days, and it seems few of people had faced this problem before.
It's very wonderful to know the tip! Thank you again! 👍

@formulahendry
Copy link
Owner

You are welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants