Start Eclipse on MacOS from Java Command line - java

I'm working with an older version of Eclipse, Helios SR1.
I need to be able to start eclipse from the terminal.
In review of http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F
I execute the following command in Terminal to start eclipse.
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -jar plugins/org.eclipse.equinox.launcher_1.1.0.v20100507.jar
and I get
Root exception: java.lang.NoClassDefFoundError:
org/eclipse/swt/SWTError
So this appears to be more complex than what was found in the above link. If I double-click the Eclipse.app it starts right up.
I'm wondering what else needs to be done to allow the Command Line Eclipse Launcher to work properly

You should just be able to use the open command:
open /path/to/eclipse.app
or
open -n /path/to/eclipse.app
will open a new instance of Eclipse even if one is already running.
If you must use the Java command you need to specify -XstartOnFirstThread before the -jar option:
java -XstartOnFirstThread -jar ...

Use the eclipse launcher binary:
<Your-Install-Path>/Eclipse.app/Contents/MacOS/eclipse
Default start-up options are set in eclipse.ini:
<Your-Install-Path>/Eclipse.app/Contents/Eclipse/eclipse.ini
Kepler start-up options are documented here: https://help.eclipse.org/kepler/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/runtime-options.html (Helios link redirects to Kepler, the oldest one they have kept available)
The launching process is explained in detail here: https://help.eclipse.org/2019-03/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/launcher.html

Related

Downloaded Eclipse IDE recently and am facing this error message every time I try to open it. What is the cause behind it and how can I solve? [duplicate]

Sometimes I have to deal with an improperly configured Eclipse installation and when I try to run it only the dialog "Java was started but returned exit code shows up without giving me any useful information to trace the actual reason Java failed to start.
What is the best approach to debug this kind of problem?
There are several command-line options that can help with troubleshooting. I'd start with -debug -consoleLog and see if that produces useful output.
You can run eclipse with the verbose attribute from command line
eclipse -verbose
Read more about debugging eclipse and plugins here http://exploreeclipse.blogspot.nl/2014/01/enable-eclipse-verbose-for-trouble.html?m=1
By default, eclipse launches with javaw.exe process, since it's a window thread so you will not be able to see any verbose messages.
Step 1: Add below VM parameter in eclipse.ini file. By default, eclipse will have javaw.exe, modify it to java.exe
-vm
C:/KK/jdk1.6.0_32/bin/java.exe
Step 2: Pass verbose parameter during the eclipse launch.
eclipse -verbose

How to make VScode debug in a specific terminal?

I was using WSL while learning programming in Python at the university, but have Java installed in the Windows filesystem. Now that we switched to learning Java, VScode is trying to debug from the WSL terminal, which does not work. How can I tell VScode to run the debug on the Command Prompt? I guess something path related but I am a bit lost.
I get the following error message:
cmd /C "c:\Users\lukas\.vscode\extensions\vscjava.vscode-java-debug-0.35.0\scripts\launcher.bat "C:\Program Files\Java\jdk-11.0.2\bin\java.exe" -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:50567 -Dfile.encoding=UTF-8 -cp "C:\Users\lukas\AppData\Roaming\Code\User\workspaceStorage\bf1d90699671e44dd71540a7194feefe\redhat.java\jdt_ws\Java DD1380_9c46b501\bin" Sumsort "
Command 'cmd' not found, but there are 17 similar ones.
Open integrated Terminal and click the selection box, choose Select Default Profile, in the popping up list box, choose Command Prompt, then press Ctrl+Shift+` to open a new integrated Terminal, it's cmd.
Debugging .java file is also executed in CMD window in terminal. See the following gif:

Command 'cmd' not found, but there are 16 similar ones

I'm trying to run a java program on windows in VSCODE. When I click the run button at the top it opens the Java Process Console and runs the following command:
$ cmd /C "c:\Users\user\.vscode\extensions\vscjava.vscode-java-debug-0.31.0\scripts\launcher.bat "C:\Program Files\AdoptOpenJDK\jdk-11.0.10.9-hotspot\bin\java.exe" -Dfile.encoding=UTF-8 #C:\Users\jbree\AppData\Local\Temp\cp_7gau2431e54dxprosf092viw9.argfile com.example.restservice.RestServiceApplication "
It then prints out: Command 'cmd' not found, but there are 16 similar ones., and I'm not too sure what to do afterwards.
I just ran into this exact issue! After some debugging, I found out it's because my terminal (in VS Code) was running off of WSL.
Make sure to check which terminal you're using! If you're trying to run Java locally, then you can configure a default shell ie. bash.
Let me know if this helps.
Edit: I also found this, not sure if it will help, but here you go!
https://stackoverflow.com/a/58058378/11060097
your java debugger is using wsl. and most likely your java is installed on windows. not linux on windows. to fix this for me, i changed the settings for java debugging to use the external console. settings->java debugger->externalTerminal . this will then use the "external windows" setting for vscode. which should use cmd.exe (the windows shell, no linux).
This error happens because you probably have wsl has your standard terminal but it's probably configured to launch cmd using a windows path.
WSL won't understand what that windows path is, so you need to change it using a path structure it can understand
So
hit Ctrl+, to hit the Settings screen
type in terminal to see all the terminal settings
You will see an option called Terminal> External:Windows Exec
Change C:\Windows\System32\cmd.exe to /mnt/c/Windows/System32/cmd.exe
I had this error too and came here initially but I managed to figure out it was an incompatible path issue that was the cause.

java how to check version being used by 'jar launcher.app' on Mac OS

I have several .jar files that run successfully when opened with Mac's built in 'Jar Launcher' (Version 15.0.1) but when ran from terminal they error out.
Looking online the error messages might be down to the incorrect version of Java being linked to the terminal version, so I'd like to check if the options set for 'Jar Launcher' and the Java used within terminal are the same.
Does there exist any way to do this?
This question is two years old, but as there is no answer to it, I thought I'd put my two cents here since I've had issues myself, and have made some observations.
It seems that the Jar Launcher doesn't necessarily use the same JVM version as the one shown by the command /usr/libexec/java_home: If there is a JRE /Library/Internet Plug-Ins/JavaAppletPlugin.plugin, then the Jar Launcher will use it and ignore anything in /Library/Java/JavaVirtualMachines.
I've solve my problem of version mismatch between the Jar Launcher and the terminal by removing the JRE:
Go to /Library/Internet Plug-Ins.
Remove the JavaAppletPlugin.plugin directory by executing the rm command as a root user or by using the sudo tool.
Go to /Library/PreferencePanes.
Remove JavaControlPanel.prefpane by executing the rm command as a root user or by using the sudo tool.
Source: https://docs.oracle.com/javase/9/install/installation-jdk-and-jre-macos.htm

Error running 'webdriver-manager start' on Windows 8.1

I am attempting to run end-to-end test for an angular project using protractor and am getting the following error when I run the command 'webdriver-manager start'
I have run webdriver-manager update, and selenium standalone and chromedriver are up to date.
I have java installed. java -version returns
I also have the path to java in my system environment variables (C:\Program Files\Java\jre1.8.0_31\bin)
Does anyone have any idea how to fix this error?
You can also start the web driver as below,
java -Dwebdriver.ie.driver=D:\Selenium_download_New\IEDriverServer.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
java -Dwebdriver.chrome.driver=D:\Selenium_download_New\chromedriver.exe -jar D:\Selenium_download_New\selenium-server-standalone-2.45.0.jar
Note the Standalone.jar should be placed in the exact location as above, you can also download the standalone.jar from selenium website
I had the same issue. Probably the webdriver update you are running is installing Selenium required files in another folder that it isn't inside your project folder. At least that was my case.
I was using a grunt task for running Protractor tests. If you are using the same plugin check this folder:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\selenium
If you don't find that folder then you are under the same issue as me. Try with another bash. You're using cmd, try with Git Bash. Locate yourself in the following directory:
C:\{yourprojectfolder}\node_modules\grunt-protractor-runner\node_modules\protractor\bin
Then run:
webdriver-manager update
Finally check the selenium folder inside your Protractor plugin. It should be created now.
I didn't have time to find why cmd is behaving different than Git Bash when running the same command inside the same folder. Each one installs the Selenium files in different places.
Maybe you are missing a system variable(C:\Windows\System32\ variable.). Adding this variable would solve your problem.
Hope, it helps!
Add "C:\Windows\System32\" to your PATHs.
On windows, right-click My Computer -> Properties -> Advanced system settings -> Environment Variables -> Edit... PATH and add "C:\Windows\System32\" to the end (with a semi-colon separating each variable).
Otherwise
SET PATH=%PATH%;C:\Windows\System32
Then start web driver using below command
webdriver-manager start
SPAWN command is not available in windows.
Install git. git bash will be installed too.
Now add git bash path to the PATH environment variable.
Restart your command prompt and it will run.

Categories

Resources