0

Hi DW

I've created a project on NaviCoder for java and when I tryied to export the project I had a problem then I redo my project using the Netbeans and that where I was then able to export or should I say build the jar file which is an executable file but the problem is that I can't run or execute this jar file outside the IDE I really don't know what is the problem with this and when I do a research on this problem I just noticed that on my project there is no lib file created when I build the project I don't know whether this is the course of this or. The project doesn't even run when I double click it, it just do nothing at all so I really don't know what the problem here. I don't know whether it the IDE I'm using or it the jre but I've just downloaded and installed for more then 20 times now. I just thought of using the eclipse I don't know whether this will solve my problem or not. any one know how can I solve this please help me out.

3
Contributors
6
Replies
36
Views
3 Years
Discussion Span
Last Post by JamesCherrill
0

try java -jar "C:/pathtojar/" with quotes.
If that does not work check and make sure you have a main class selected in netbeans:
1) Right click the project select properties
2) In the left hand pane select "Run"
3) under Main Class: your runnable class should be selected.

Edited by DarkLightning7

0

It's not clear where you are hitting the problem. Do you have the .jar file that NetBeans creates (in the build directory of your NetBeans project).

0

It's not clear where you are hitting the problem. Do you have the .jar file that NetBeans creates (in the build directory of your NetBeans project).

Yes I do hava it and it the same .jar file I'm trying to run but when I double click it, it just do nothing and if I try the command method the cmd.exe says Error unable to access the "jarFile" I've tried even if I just put the full path but it says it can't access the file I don't know why.

0

Thanks I was so stupid the application that I created uses the consol to display so it seems as if I can't or it can't start a consol on it own so I recreated the whole project and I just monited each and every move the IDE do then I saw that it instructed me to type the java -jar "C:\Users\Me\Documents\NetBeans Project\My Project\myproject.jar" to run it and I just typed as I see it and wow it debuged thank you so much everyone. I will create another thread because there is another question I have which I discorved when i was debugging.

0

No, not stupid. It's not obvious!. It's because of the difference between java.exe and javaw.exe
You use jave.exe to run your jar and that has a console.
javaw.exe is for windowed applications, and does NOT have a console.
The default installation of java associates javaw.exe with .jar files, so, by default, if you run a jar by double-clicking it, it does not have a console.

Edited by JamesCherrill

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.