This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 158583 [details] captured screen of the error given When run from within Netbeans the projcets work fine. However after building the project (any project, even something as simple as a fresh new project with a System.out.println("hello world"); line and nothing more)and travelling in windows to the project's folder\dist and trying to run the generated jar file, constantly a popup error occurs: "Could not find the main class: project.classname. Program will exit" (see attached file to see the error) I've recently installed the new version of Netbeans with Java. Could this be the problem? I haven't had this issue before. from the about, these are my settings: Product Version: NetBeans IDE 8.1 (Build 201510222201) Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1 Java: 1.8.0_73; Java HotSpot(TM) 64-Bit Server VM 25.73-b02 Runtime: Java(TM) SE Runtime Environment 1.8.0_73-b02 System: Windows 10 version 10.0 running on amd64; Cp1255; iw_IL (nb)
Can you please attach the problematic jar? What type of project do you use? Thanks
Created attachment 158602 [details] the asked problematic .jar file Here's an example of a problematic .jar file
sorry, I forgot to answer this. The project I'm using is a regular java application
The jar I've posted works correctly for me. There is probably something wrong with the .jar association in your system. The correct command to run this jar should be: "java -jar HelloWorld.jar" Please try run this in command line (java_home/bin must be in the PATH variable). If it still does not work, please attach output of this command
I'm sorry, I don't understand. I'm not very knowledgable about operating systems beyond simple use. Where do I find this command line? do you mean type in "c:\...\my project folder\bin\java -jar HelloWorld.jar" somewhere?
On windows just run "cmd.exe" program. It will open the command line. The cd to your project directory and type: ...java home...\bin\java -jar HelloWorld.jar
Created attachment 158663 [details] captured screen of the error given and the folder and cmd window
Thanks for info. Can you please try typing simply "java" and "java -jar HelloWorld.jar" commands?
Created attachment 158668 [details] screenshots of cmd
Created attachment 158669 [details] update wait, i've done it in the dist folder and it gave me the hello world. does that mean it worked that way? why is that?
so the jar is ok, it is exactly how it should work. I guess the problem is how the java is installed on your system. At first I'd check java version, you can type java --version to find out which version is actually used.
I don't think I understand you. No version of what you said that I tried yielded any resault. Could you give me an example of how to type this? (for instance my jar file is C:\HelloWorld\dist\HelloWorld.jar so would I type after getting to C:\HelloWorld\dist\ java -jar HelloWorld.jar --version?
just type java -version to command line. Not need to have a jar. This will print out the version of actual Java, then please check in the Tools -> Java Platform which version of java does the IDE use. The output of command should be something like: java version "1.8.0_65" Java(TM) SE Runtime Environment (build 1.8.0_65-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
Created attachment 158698 [details] the java version both in netbeans and in cmd ok, see the screenshot, seems the same to me
Still not working. No other ideas? was this closed? i didn't mean it to be. the problem still persists
The issue is closed since the problem is not in Netbeans itself. The jar is created correctly. The problem is in java integration into your OS