Remote execution / debugging of Java code from Eclipse (or IntelliJ IDEA) - java

I'm wondering if there is an easy way to test my code on remote boxes.
What I'd like to do:
Edit my code in Eclipse locally.
Set up a run configuration that points at a remote host (with login
credentials).
Click "run" and have it just work.
The IDE would connect via SSH, copy over or synchronize all of the files in the project to the remote box, run the java command remotely, and let me step through the code in my local IDE.
Possible?
I use Eclipse, but I'd pay for Intellij IDEA if it would do this one thing.

IntelliJ Idea has remote debugging feature.
There is a "remote" debug configuration option available
Run > Debug > Edit Configuration > Add New > Remote
. You have to provide server configuration and connection parameters.
Both the Community Edition and Ultimate Editions have this feature.
I hope this is the feature you are looking.

Related

how to setup a libGDX project via proxy

I am using the libgdx project creator (gdx-setup.jar) to setup a new project. However, I am using a proxy connection on my Windows machine to access the internet and the gdx-setup.jar isn't able to detect the settings, thus I cannot download the required jar files and generate any project. How and where do I change the java proxy settings so that I am able to achieve this?
PS: I have already tried to edit the settings under Control Panel->Java->Network Settings but to no avail.
From Gradle's manual: 12.3. Accessing the web via a proxy
You may need to create a $HOME/.gradle/gradle.properties file. For example:
systemProp.http.proxyHost=10.0.0.1
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=
systemProp.http.proxyPassword=
systemProp.http.nonProxyHosts=*.some.domain.com|localhost
IMPORTANT: There are separate settings for HTTPS.
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
Then, just run setup like this:
java -Dhttp.proxyHost=10.0.0.1 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=10.0.0.1 -Dhttps.proxyPort=8080 -jar gdx-setup.jar
This works for me, behind a HTTP Proxy. Change it with your proxy settings.
Later, import your projects into Eclipse. And make sure your Eclipse Network Proxy is OK too.
Here is a working solution:
http://badlogicgames.com/forum/viewtopic.php?t=16414&p=70348
For windows 7, gradle.properties is under C:\Users\USER_NAME.gradle\ (or create one if not exist)
Steps:
1. prepare gradle.properties file with following content
org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx1500m
org.gradle.configureondemand=true
systemProp.http.proxyHost=
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=
systemProp.https.proxyPort=8080
run the jar through the same proxy
java -Dhttp.proxyHost=**** -Dhttp.proxyPort=** -Dhttp.proxyUser=******** -Dhttp.proxyPassword=**** -jar gdx-setup.jar
If you run gdx-setup.jar from the command line, you should be able to tell the JVM to use the proxy settings using http.proxyHost and http.proxyPort.
See: How do I set the proxy to be used by the JVM for more information.
The command line would be something similar to:
java -Dhttp.proxyHost=10.0.0.1 -Dhttp.proxyPort=8080 -jar gdx-setup.jar
I was able to workaround this problem using Eclipse with proxy configured in
Window -> Preferences -> Network Connections
I think it should be possible also in other IDEs or even Gradle (if you install it manually), provided that they have properly configured proxy.
This is because the Project Creator creates the whole directory structure, classes, etc., it fails later, when trying to download Gradle.
What I did after it failed is I went to Eclipse, I chose 'Import as Gradle project' and then clicked the Build Project button.
This downloaded Gradle and all the needed jars.

Creating and debugging app with springmvc and eclipse with internal server

I currently have a sprimgmvc app that uses maven. I am currently using mvn:package to build war and deploy it to tomcat to develop and this is getting very cumbersome. I dont have the eclipse configured to automatically build and deploy to tomcat for that matter?
Can anyone please provide me steps that I need to take so that if I make any changes in my project I can just hit save and run and it will deploy to the tomcat OR a way in which I dont use tomcat but use maybe jetty or something else to build and test my app?
Thank you
download STS > Import your project as maven project to the new workspace > mvn install (only once to download all your dependencies) > run AS > Server > baam!
For any other eclipse version pretty much the same but you need to open the server window and configure tomcat , basically open the server tab > new > select your tomcat installation path and then .. just run it on the server. You can even modify code while running your app.
I was able to make this work using some helpers from: Running Tomcat from within Eclipse always gives me 404 (but index.html works) and following these steps:
I suspected that there was something wrong with the initial set up in eclipse. So, I closed the project in eclipse using: Right Click project > Close Project
Then I deleted any files related with eclipse from the folder. These were: .settings, .project, .classpath
I then Re-imported the project as maven project.
I used Window > Show view > server view
In the server view I created a new server and pointed it to XAMPP > tomcat since I already had tomcat.
Right click on the project > Run As > Run on Server.
It should run properly at that point in the browser as well
Make sure to check Right Click Project > Properties > Deployment Assembly - There should be Maven Dependencies added to the project and the deploy path for that should be "WEB-INF/lib"
here is a my way to debug and run maven web project with eclipse. though code is not hot deployed but it works fine for me.
Steps are as follows
open command prompt and go to your project directory. Lets say it is /opt/myhome/myproj
run mvnDebug tomcat:run command, make sure you have mvn and mvnDebug at system path
A message will be appeared like one mentioned in screenshot attached below, this states that maven is waiting for remote connection.
Now we need to Remotely connect to maven from IDE. To do that
Right click on the project and select "DebugAs" ---> "Debug configuration"
Add an new entry under Remote Java application with highlighted details and then select Debug button.
switch back to your terminal and you will get a screen like one displayed below
your web app is ready to debug, put a break point and call it and your IDE will switch to debug perspective
We are done with it. now if you make some changes in your code. you need to stop it from terminal with Ctrl-C and re-execute mvnDebug tomcat:run and then Remote Debug from IDE.
As i mentioned in starting code is not hot deployable as in local debug mode but it is pretty much better approach than rebuilding war and deploy it to external tomcat instance.
I hope this targets your query

how do i integrate jboss with eclipse to run debug process

hey guys please help me to find a way out for debugging my application on eclipse helios.
i have to configure jboss and debug my application
please guide me
thanks a lot
If you're deploying your application via Eclipse, then heldt's comment above is enough for you. However, if you're not you can make use of the remote debugging capabilities built-in to the Java platform.
Import your project into Eclipse
Start JBoss in debug mode (make note of the port being used, it's usually 8787) by editing the configurations to look like the following:
set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n %JAVA_OPTS%
Use the debugger in Eclipse to connect to the server process on the debug port. On my setup of Eclipse 3.5, I need to go to Run > Debug Configurations, select Remote Java Application from the sidebar, create a new configuration and set the appropriate connection parameters.
Here are are links to a few tutorials that explain this process in more detail:
http://blog.mangar.com.br/?p=53
http://www.jacoozi.com/index.php?option=com_content&task=view&id=119&Itemid=134
http://onjava.com/onjava/2005/08/31/eclipse-jboss-remote-debug.html
http://java.sys-con.com/node/44918

Is it possible to debug GWT client code on a REMOTE server using IntelliJ 9 Community Edition?

I'm trying to move our Google Web Toolkit (GWT) development from Eclipse to IntelliJ 9 Community edition. So far I've been able to run and debug client/server code successfully via the GWT Maven plugin and its embedded Jetty container.
However, I'm having trouble debugging client code when it is already running on a remote machine (and hence there's no need for the embedded Jetty container).
Has anyone been successful at achieving this? Any help would be appreciated!
UPDATE: I was finally able to accomplish this. Please see my own answer below...
I was finally able to accomplish this by using GWT's DevMode class, as described in the documentation.
In short -
Add your project to IntelliJ 9 Community edition
Add an Application run/debug configuration
Use com.google.gwt.dev.DevMode as your main class (make sure to include gwt-user and gwt-dev jars to the project classpath. See here)
Add the following program parameters:
-noserver -war "[full path to your exploded war]" -gen "[full path to generated files]" -logLevel INFO -port [remote server port] -startupUrl "[URL of the remote page]" [com.company.YourEntryPoint]
This way, the DevMode runner will not instantiate the built in container and will allow your remote server's JavaScript to be debugged in its original Java form.
Note that for builds that don't require debugging remote client code you may use Maven or Ant integration, which is much simpler. I don't have any experience with the webAppCreator generated build.xml, but with Maven you could simply run the gwt:run or gwt:debug goals with this parameter: -DrunTarget=
Hope it helps!
When running a GWT app deployed on a remote server, the client part of your app will have been translated into javascript so I do not think you will be able to debug this from IntelliJ. The server side part of your app will still be Java code. You should be able to start up this remote server with java debugging parameters (things like a transporttype and a port to listen to). From IntelliJ, you should be able to start up a remote debugging session using the same transporttype and port.
If you look into remote debugging, you should be able to find how to do this.

Preferred way of developing web applications with m2eclipse

When developing Maven web applications I usually resort the the jetty-maven-plugin to quickly launch my application for local testing and debugging. Using the launch with m2eclipse has the drawback of not properly including all sources for debugging, even though they are downloaded by Maven ( see Source lookup does not seem to work ).
What is the preferred way to debug Maven web applications in Eclipse? I'd especially appreciate configurations which work with the gwt-maven-plugin.
My preferred way to develop web applications with m2eclipse is to... not use it. Instead, I use the approach described in Debugging with the Maven Jetty Plugin in Eclipse that I'm quoting below:
Step 1
Go to the Run/External Tools/External
Tools ..." menu item on the "Run" menu
bar. Select "Program" and click the
"New" button. On the "Main" tab, fill
in the "Location:" as the full path to
your "mvn" executable. For the
"Working Directory:" select the
workspace that matches your webapp.
For "Arguments:" add jetty:run.
Move to the "Environment" tab and
click the "New" button to add a new
variable named MAVEN_OPTS with the
value:
-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y
If you supply suspend=n instead of
suspend=y you can start immediately
without running the debugger and
launch the debugger at anytime you
really wish to debug.
Step 2
Then, pull up the "Run/Debug/Debug
..." menu item and select "Remote Java
Application" and click the "New"
button. Fill in the dialog by
selecting your webapp project for the
"Project:" field, and ensure you are
using the same port number as you
specified in the address= property
above.
Now all you need to do is to
Run/External Tools and select the name
of the maven tool setup you created in
step 1 to start the plugin and then
Run/Debug and select the name of the
debug setup you setup in step2.
From instructions provided by
Rolf Strijdhorst on the Maven mailing
list
Stopping Jetty
In order to stop the jetty server the
"Allow termination of remote VM"
should be checked in debug dialog in
Step 2. When you have the jetty server
running and the debugger connected you
can switch to the debug perspective.
In the debug view, right click on the
Java HotSpot(TM) Client
VM[localhost:4000] and chose
terminate. This will stop the debugger
and the jetty server.
Try to avoid writing code which needs a container of some kind to debug. Always write code that can run independently and wrap it in a very thin layer for deployment (thin layer -> few lines of code -> few bugs).
If you really must, try MockRunner to emulate the app server.
Other than that, you can manually add the sources in the project properties.

Categories

Resources