is there a way to display, in Eclipse, the full command line that is used to execute a java application?
I am using Juno.
Thanks in advance.
I'm not sure what you're asking, but if you're looking for the full command line of the current execution, I'm not aware of a place you can see that in Eclipse. If you are on Windows though, I'd recommend SysInternals (now Microsoft) Process Explorer. Below is an example of the properties of a process I started in Debug mode from Eclipse.
Related
I'm migrating from Eclipse IDE (+ VSCode for coding Java servlets and HTML/CSS/JS webpages, respectively) to only Visual Studio Code for its lightweight.
I have several Java extensions installed for VSCode:
Language Support for Java(TM) by Red Hat
Tomcat for Java
Debugger for Java
Eclipse has a series of settings for hot reloading:
- Automatically publish when resources change
- Refresh using native hooks or polling
while VSCode doesn't seem to have any for me.
A few things I've try to reload my Java and web code:
Restart Tomcat server
Delete and re-adding Tomcat server
Delete and regenerate .war package (not sure if this does anything, it can run well without a .war package)
Good news...
It works automatically now. With Tomcat for Java Extension (And the rest of the Java Extension Pack):
https://marketplace.visualstudio.com/items?itemName=adashen.vscode-tomcat
Just make sure your settings are like this (search for "java.autobuild" to get those two in the first results):
Very important is, that you wont see any logs in the console on the HCR (Hot Code Replacement) like it happens in Eclipse ... but you in fact will see the replaced code behavior. Just debug over the piece of code you changed, and you will see it in fact changed in the running server.
UPDATE: I've found it works better with the 'manual'(default) setting. Just clicking once in the lightning icon. (Testing in Ubuntu 18.04 LTS)
[I say it works better because if I added lines to a Class' code with the 'auto' setting it will not add that code ... only if I change code in the existing lines. But with the manual setting I just save the file, and then click the lightning icon wait ~3 seconds myself and debug over the new code ... and everything goes well!!
... This solves my coding needs(lightweight Editor/IDE with Hot-Code-Replacement in Tomcat)]
Enjoy !
This article may be helpful, I migrate from other IDE to Vscode.
According to the article, if you install Debugger for Java, it enabled Hot code replacement(HCR) and then :
You can start a debugging session and change a Java file in your development environment, and the debugger will replace the code in the JVM running your code.
Hot code replacement for java comes to visual studio code
Install “Tomcat for java” extension in VScode.
Configure the Path of Tomcat in the above extension.
Now you should be able to run tomcat in usual build -> deploy mode. Now install DCEVM, By using “java -jar installer-light.jar”. (Select “Install DCEVM as altjvm”)
Place HotSwap Agent Jar in directory of your choice.
Now In VScode right-click the Tomcat server you have created. (The one from Step 3 ) And select “Customise JVM Options”.
In the file opened, Place “-XXaltjvm=dcevm
-javaagent:/[your_directory]/hotswap-agent-1.3.1-SNAPSHOT.jar” Now Right-click the tomcat server in VScode and select “Debug WAR package”, And select the WAR file.
If everything goes well, The WAR will be start in TOMCAT in debug mode with text “HOTSWAP AGENT” in the log.
Now your every save to your file will trigger Hot Reloading.
https://medium.com/#manoj_makkuboy/hot-reload-java-8-tomcat-server-in-vscode-ba6233d632e?
Sorry if this is too naive, but shouldn't it be something like eclipse.exe?
The links provided in the comments are quite informative, but if you still aren't able to understand why Eclipse shows as javaw.exe in the Task Manager, then refer to this answer. (Excerpt below)
javaw: (java windowed) Application executor not associated with console. So no display of output/errors. Can be used to silently push the output/errors to text files. Mostly used to launch GUI based applications.
Eclipse is a GUI based development tool and hence the process associated with Eclipse reads javaw.exe in Task Manager.
If you need it to be run as eclipse.exe, you can pass in the following parameter in your eclipse configuration file:
-vm <your java installation folder>\bin\client\jvm.dll
Eclipse is a program, which runs upon Java Virtual Machine. javaw.exe is a process, corresponding to JVM.
I have some ant scripts that create various things from the command line.
My command environment is complex, and we are doing some icky things I don't really want to do in eclipse, that won't really run from an ant script invoked inside eclipse. But if there is a way to have an ant script in eclipse start the server, that would be OK too.
Sometimes they take a while to run. It would be nice if when they were done, I could start my Java EE server inside eclipse. I happen to use JBoss 1.4.2 if that matters. I would like to start it in debug mode if possible. This way I could test without having to navigate to the server and start up debug from within eclipse as soon as my code finishes building. Is there any easy way to do this?
You can always manage your Application Server externally. by calling <JBOSS_HOME>/bin/run.(sh|bat) -b <ip_address> (JBoss 5) or <JBOSS_HOME>/bin/standalone.(sh|bat) -b <ip_address>
To start and stop your server from ant and having it appear as if you started it from within eclipse, that is a harder task. You would have to create a Run/Launch Configuration from within eclipse and then call it from ant see Launch an Eclipse Run Configuration from ANT
I'm in the process of porting simple console apps written in C++ to Java in order to show how similar the languages are, and how code can be ported. I've exported executable JARs for the programs using Eclipse. These JARs work fine when they are run using the java -jar command. However, they do not run properly when executed from windows explorer (double clicked). A console window simply opens and closes rapidly.
The only solution I have found thus far is to use a batch file. Is there any other option?
There are some options:
Sleep a bit when the program is done, so you can read the output.
Call System.in.read() (again at the end of the program), which will wait until you type a char and hits enter.
Create your own little swing terminal, which doesn't close when the application code is done.
This seems like the jre used from the command line and from the registry are not the same (this can occur when multiple JRE's are installed)
Have you checked in your windows registry what is the jre used to run the executable jars ?
You can find more on the registry settings on sun's site
Seems to me that your main class does not even gets executed.
This would explain the quick open/close of console window.
Or is it possible that another program than java has the "jar" file type?
Happened to me after installing a Nokia software.
Using a batch file seems to be my best option. I suppose that's why Eclipse has a launcher.
Change the open with program to
c:\Program files\java\jre7\bin\javaw.exe
I am trying to run an automated suite every day at the same time, so I want to create a task to open eclipse and execute the main script every day. Is there a way to do this from the command line?
Instead of using eclipse for it, use a software that is dedicated for it - continous integration servers are created for it. Check such titles like: hudson, cruiseControl, TeamCity
You are on the wrong path. Instead of trying to automate opening eclipse, executing a main... break the IDE dependency, write a portable build script using Ant or Maven and execute that build script outside the IDE (using a simple cron job or something more elaborated like a Continuous Integration tool but I'm not sure you need a CI tool for now, start with the build script).
So I am assuming that you want to automate something that you run from inside eclipse. if it's a build then I'm with the other guys that using a build script and CI is the way to go.
But in case it's not that use case...
Now, if you are using the "Run.." dialogs to do this you can actually get the command line paths, binaries and arguments that eclipse used to execute.
What you do is open up the debug perspective. Then run your script however you normally do.
Your Process should appear in the "Debug View" at this point.
Either while the process is running or after termination, right click on the process and open up the properties. (you may need to click 1 level down in the tree to get this option)
Under process info, inside of that there is a section "Command Line". This is the exact command line that eclipse executed behind the scenes to run.
you should be able to put this into a script (.bat for windows / sh for *nix) and schedule accordingly.
edit: added in assumptions, changed to use process info terms which is what is on the properties screen.