Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Can't run java program in Eclipse - javaw error(error)
Can't run java program in Eclipse - javaw error [message #1785427] Fri, 13 April 2018 16:49 Go to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
I have been using Eclipse a long time for Java programming. I stopped using it for a while and i came back to it yesterday and upon running a program i get the following output:

Usage: javaw [-options] class [args...]
(to execute a class)
or javaw [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.


I know this is the help screen of `javaw` which is very strange. It doesn't seem to see my file. I am on Windows 8.1 x64.

- Eclipse can build just fine
- I can both compile and run java files from the terminal
- latest java 8 jvm jre installed from Java website today v1.8.0_162
- System EnvVars:
1. CLASSPATH: `.;C:\Program Files\Java\jdk1.8.0_162\lib;C:\Program Files\Java\jre1.8.0_162\lib;C:\aspectj1.8\lib`
2. JAVA_HOME `C:\Program Files\Java\jdk1.8.0_162`
3. PATH includes: `C:\Program Files\Java\jdk1.8.0_162\bin`
- I've looked everything at my eclipse.ini and it looks fine. It's almost identical to the equivalent eclipse i have for Linux which works great.
- I have gone to the "Debug" tab to see what command Eclipse actually executes, and its `C:\Program Files\Java\jre1.8.0_162\bin\javaw.exe` which looks good, it's in my default "Installed JRE"
- I set all Eclipse settings back to their defaults

I've been troubleshooting this all day. I now give up on Eclipse Java, unless someone can help with this. This has occurred once again in the past but i solved it back then, by simply updating Java.
Re: Can't run java program in Eclipse - javaw error [message #1785428 is a reply to message #1785427] Fri, 13 April 2018 17:10 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

Are you sure you installed the 64-bit Eclipse?

IIRC I had similar issues after naively trying to use a 32 bit Eclipse.

Regards

Ed Willink
Re: Can't run java program in Eclipse - javaw error [message #1785430 is a reply to message #1785428] Fri, 13 April 2018 17:14 Go to previous messageGo to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
Yes it is 64bit. I re-checked it.
Re: Can't run java program in Eclipse - javaw error [message #1785438 is a reply to message #1785430] Fri, 13 April 2018 17:47 Go to previous messageGo to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
This is my eclipse.ini file's contents:

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
/../../Users/username/.p2/pool/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.java.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/../../Program Files/Java/jdk1.8.0_162/bin
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/

[Updated on: Fri, 13 April 2018 17:51]

Report message to a moderator

Re: Can't run java program in Eclipse - javaw error [message #1785440 is a reply to message #1785438] Fri, 13 April 2018 18:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6044
Registered: July 2009
Senior Member
Hi

"/../../Users...", "/../../Program Files" look really smelly. Surely they try to navigate above the root? No idea where they end up.

Regards

Ed Willink
Re: Can't run java program in Eclipse - javaw error [message #1785441 is a reply to message #1785440] Fri, 13 April 2018 18:07 Go to previous messageGo to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
No they're just fine. I've tried to set them other ways too, like C:\Users\username\...

It makes no difference no matter what.
Re: Can't run java program in Eclipse - javaw error [message #1785443 is a reply to message #1785441] Fri, 13 April 2018 18:20 Go to previous messageGo to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
It's hard to believe this. I completely uninstalled Eclipse and all its contents from C:\users\username\.p2 and the like and re-downloaded. Created a blank workspace and file and the same error pops up. I don't know what i have done wrong.

Now my pydev installation is also messed up, because i removed .p2

...
Re: Can't run java program in Eclipse - javaw error [message #1785451 is a reply to message #1785443] Fri, 13 April 2018 22:16 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1627
Registered: July 2009
Senior Member
Any particular reason why the -vm option does not include java.exe?
Please see https://wiki.eclipse.org/Eclipse.ini#-vm_value:_Windows_Example
Re: Can't run java program in Eclipse - javaw error [message #1785453 is a reply to message #1785451] Fri, 13 April 2018 22:58 Go to previous messageGo to next message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
I am at a loss, truly.

I uninstalled Java and eclipse completely, rebooted. Reinstalled java, setup envvars, setup eclipse again new folder, new workspace, configured and i still get the exact same error.

I can still compile & run from command line though.


When the error occurred initially i had no -vm options, i added them later trying to fix the issue, it made no difference. The newly installed eclipse doesn't have a -vm option either.

[Updated on: Fri, 13 April 2018 23:04]

Report message to a moderator

Re: Can't run java program in Eclipse - javaw error [message #1785465 is a reply to message #1785427] Sat, 14 April 2018 09:32 Go to previous messageGo to next message
Ricardo de Sousa is currently offline Ricardo de SousaFriend
Messages: 1
Registered: December 2015
Junior Member
Hi. Try installing the last version of Oracle JDK. I had the same problem and I did it.
See you.
Re: Can't run java program in Eclipse - javaw error [message #1785466 is a reply to message #1785453] Sat, 14 April 2018 10:26 Go to previous message
Nikos LazCob is currently offline Nikos LazCobFriend
Messages: 9
Registered: November 2016
Junior Member
I remove Java 8 and then installed Java 9, which i never had before. Now everything seems to work.

I do not understand what was the problem though. I'm guessing it has to do with the registry.

[Updated on: Sat, 14 April 2018 10:27]

Report message to a moderator

Previous Topic:How to pin to Start Eclipse Oxygen on Windows 10
Next Topic:Typesafety comiler bug
Goto Forum:
  


Current Time: Tue Sep 25 21:07:10 GMT 2018

Powered by FUDForum. Page generated in 0.01777 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top