Passing proxy settings to a bundled JRE install4j application? - install4j

We provided an application installed with install4j, with bundled JRE, to one of our customers. This customer needs some proxy settings configured manually for this application.
I tried to put deployment.config file in the JRE's lib directory but it didn't seem to change anything. I couldn't find a relevant vmoptions either.
Is there a way to pass these settings to the app/jre?
Is there also a way to instruct the JRE to open the Java console when it runs?
Thanks!
/Shmulik.

You can configure the proxy by setting the VM parameters
proxySet=true
proxyHost=...
proxyPort=...
and for authentication
proxyAuth=true
proxyAuthUser=...
proxyAuthPassword=...
You can set them either in a "Run script" in the startup node of the installer action by calling System.setProperty() for the properties or by passing them on the command line like this:
-DproxySet=true -DproxyHost=... etc
As for your second question (better to ask a separate question on stackoverflow)
Is there also a way to instruct the JRE to open the Java console when it runs?
I assume you mean a terminal window, which can be done by selecting the "Windows console executable" property of the installer. You cannot change this property on the command line because this sets a static flag in the binary format of the Windows executable furing compilation.

I created an installer for WINDOWS as well as for MAC. The
application is using an embedded JRE. While the application runs, it's not
able to detect the proxy settings of the network even the option in
the browser is set to be "Auto Detect". But when the proxy settings provided explicitly in the browser, it's able to detect the proxy settings.
Even the proxy settings are not detected when "LAN Settings->Use automatic configuration script" option is selected and points to the .pac file.
Any suggestion, how to provide the proxy settings with BUNDLED JRE and java program can detect those settings without make any further changes in each machine.

Related

Can a "run configuration" ensure another app is running?

When working with Mule ESB, we need to have (in our case) ActiveMQ running (in a terminal) or it won't work. That's fine, but I sometimes forget to start ActiveMQ, which caused me to wonder...
Can I somehow explain to my "Run configuration" that it should start an external program in conjunction with starting the run|debug session? And if so, can it be configured to only start it if it's not already running?
I am not sure whether you can run the external application using your project run configurations. But from mule studio you can start the external application using Run--> External tools. Refer the below kink for details
http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.user%2Ftasks%2Ftasks-exttools-running.htm
Eclipse CDT contains a useful type of launch configuration called a Launch Group. With a launch group you can set up different launches to run and what order. You can optionally add delays between launches (to allow for your service to start) or wait for a set up launch to terminate before running the next one.
To install the launch groups you can add "C/C++ Development Tools" to your installation.
Once installed, you should have a new launch type called a launch group.
Here is an example of one that may address your first question:
Launch Group Example
As my example shows, you don't need to have any CDT launches to be able to use Launch Groups.
As for your second part. This is in active development. Eclipse EASE is adding full scriptability to Eclipse and as it turns out I have just written a post about adding launching capabilities to the scripting. You can follow that work on bugzilla: Bug 478397

Blank profile name in Eclipse, Websphere Settings

I am trying to add a New Server (WebSphere Application Server 7) to Eclipse (Kelper). I have just installed WebSphere Application Server 7 on the PC but have not changed any settings yet (default settings).
In Eclipse, after New Server -> WebSphere Application Server Settings it shows me the following:
As you can see the Profile name box is empty, with no choices in the drop down box. When I click Configure profiles... I see:
At this point I am stuck. I'm guessing that I already have a profile setup in websphere, but that maybe it doesn't have write permissions yet?
What do I have to do to get this server working in Eclipse?
Based on the second image looks like you dont have any profiles. Check if you have any profiles (folders) e.g. AppSrv01 in the C:\Program files\IBM\WebSphere\AppServer\profiles.
If you have - it means that you dont have write permissions to that folder - try to run Eclipse as Administrator. Did you installed WebSphere with your user or Administrator? In general as a best practice you should avoid installing WebSphere in Program Files.
If you don't have - create it using for example Profile Management Tool - should be available in your Start menu.
You probably don't have rights, because the "Run Profile Management Tool" button should be enabled, if you would highlight WebSphere Runtime in upper table.
I have same issue.
If you install websphere in
C:\IBM\WebSphere\AppServer\profiles
instead of:
C:\Program files\IBM\WebSphere\AppServer\profiles
Then it will solve lots of configuration problems related to access.
Hope it helps
If your C:\Program files\IBM\WebSphere\AppServer\profiles dir is empty go to:
http://www-01.ibm.com/support/docview.wss?uid=swg21442487
Download the attached zip and extract it to WebSphere's bin directory and run the bat/sh.

Eclipse : Whether to select Local Or Shared File during Remote Debugging

I have made some code changes and deployed the code to Jetty Server which is located Remotely .
Accessed the application through browser and I am trying to debug a Application .
Please tell me whether i need to select the Local File Or Shared File from the Eclipse Debug Configurations .
Please see the screen shot here .
The option shown in your screenshot will not help you automatically get code deployed to your remote Jetty.
The option simply allows you to Share your launch configuration (Remote Java Application - ManageWatchlistCall) in your eclipse workspace. This will allow you to checkin the launch configuration in a versioning control system so your colleagues automatically get the sme Remote Java Application launch configuration.
in order to get new code to your remote server, there are only 2 options :
Redeploy your application on the remote server.
Hotdeploy pieces of code to the remote supported (if the server supports it)
Use Hotswap Bug Fixing (works for small fixes) (*)
(*) If you are running Java Virtual Machine (JVM) V1.4 or higher,
Eclipse supports a feature called Hotswap Bug Fixing (not available in
JVM V1.3 or lower). It allows the changing of source code during a
debugger session, which is better than exiting the application,
changing the code, recompiling, then starting another debugging
session. To use this function, simply change the code in the editor
and resume debugging.

How to run build using graphics drivers by using optirun (Bumblebee) from IDE (Netbeans, Eclipse)?

Does anyone know how to make eclipse or netbeans use the graphics card in optimus laptops by invoking optirun (bumblebee) inside the IDE so that one can just use the run button in the IDE to run the program in a graphics card within the IDE.
In simplest form I just want the IDE to do the equivalent of optirun ./javaproject
The way I did this in Eclipse was to first start the Java debugger jdwp and listen to a port. Then start the JVM with optirun java ... and use jdwp to connect to this port. Both tasks can be started at the same time in Eclipse by creating a Launch Group in the debug configuration settings (Run -> Debug Configurations). In detail:
Create a Remote Java Application debug configuration with "Standard (Socket Listen)" Connection Type and some arbitrary port, e.g. 56789. This attaches the Java debugger jdwp on port 56789 to a virtual machine which accepts debug connections at this port.
Now we need to start a JVM with optirun. This can be done with a External Tool Configuration (Run -> External Tools -> External Tool Configurations). Create a new Program configuration in the left side of the External Tools Configurations window. You could directly start optirun java <additional arguments> by filling in the required fields. However, I have decided to use a shell script which is reusable by different projects (As can be seen below, there is one part missing to make it entirely reusable. I'm glad for any help from more experienced Eclipse users...). Hence, the Location field points to this shell script. The script itself accepts three arguments: the classpath for the project, the name of the Java executable, and the port number. These arguments can be passed to the script in the Arguments field of the Main tab, e.g.
${project_classpath:${selected_resource_name}}
ExecName
56789
The shell script looks like this, assuming optirun is in your PATH:
#!/bin/sh
CLASS_PATH=${1}
JAVA_EXECUTABLE=${2}
PORT=${3}
# TODO: fix this java library path: pass it as an argument as well. Is there an Eclipse variable which stores this?
JAVA_LIBRARY_PATH=/usr/local/share/OpenCV/java
#------------------------------------------------------------------------------
optirun ${JAVA_BIN} -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:${PORT} -Djava.library.path=${JAVA_LIBRARY_PATH} -Dfile.encoding=UTF-8 -classpath ${CLASS_PATH} ${JAVA_EXECUTABLE}
#------------------------------------------------------------------------------
Finally, the two pieces are brought together in a Launch Group in the Debug Configurations window (Run -> Debug Configurations). Create a new Launch Group and add the two previously generated Debug configurations by clicking on Add in the Launches tab and by selecting the appropriate configurations.
Note that due to the classpath variable in step 2 (i.e. ${project_classpath:${selected_resource_name}}), the appropriate package needs to be selected in the Package Explorer before clicking on the run debug configuration button (make sure that the Launch Group is selected).
This solution works perfectly for me: I can debug Java code inside Eclipse which calls native code involving CUDA optimizations and Bumblebee only activates the discrete graphics card when necessary.
Just use optirun to start the IDE. For example, optirun eclipse or optirun netbeans
I build the project in Netbeans (F11) and run the following in a terminal:
optirun java -jar path/to/javaproject/dist/javaproject.jar
Mind that if you have any java parameters in your project, you need to add it manually. My workflow is like this:
Locate the Java options from the project, open Project -> Properties, Run. At VM Options I see -Djava.library.path=lwjgl/native/windows;:lwjgl/native/linux. I also have some parameters that I want to pass to main(String[]). With this information, I open a terminal and run:
cd path/to/javaproject
optirun java -Djava.library.path=lwjgl/native/windows;:lwjgl/native/linux \
-jar dist/javaproject.jar some paremeters
Another hint, if you have to open and close the program frequently, run optirun bash in a different tab so that preparing the use of the graphics card becomes faster. Alternatively, you can run optirun netbeans, but that means that the nvidia card will always be on even if you are programming which increases power use and increase the heat.
Important: if you are using a 32-bit JVM or Java libraries on a 64-bit machine, you also need to install the 32-bit drivers and libraries. For Ubuntu, the nvidia package already contains 32-bit drivers, see this answer. For other distros, you likely need to install lib32-* packages for Mesa, VirtualGL and nvidia-utils.
You can also rename java to java_real and use this portion of code as your java command :
#!/bin/bash
path=$(dirname $(readlink -f $0))
args=""
runner="$path/java_real"
for var in "$#"
do
if [ "$var" = "-3d" ]; then
runner="primusrun $runner"
else
args="$args $var"
fi
done
$runner $args
NOTE : I had to do this in /usr/lib/jvm/java-7-openjdk-amd64/jre/bin, not in /usr/bin to make it work with Eclipse.
In Eclipse, just add "-3d" in your program arguments and you're good to go !

Is it possible to debug PL/Java (ideally from Eclipse)?

Although I found PL/Java a powerful add-on for PostgreSQL, I couldn't find a way of remotely debug the clases loaded on the PSQL DBMS.
Is this possible to achieve?
Thanks in advance!
I suppose you could set pljava.vmoptions to enable debugging and include a port number to listen on, and then use Eclipse's "debug remote application" launcher to connect to it.
So a JVM option -agentlib:jdwp=transport=dt_socket,suspend=n,address=localhost:55000 will make the JVM listen on port 55000 for debuggers. You then open the "Debug configurations.." dialogue in Eclipse, right click "Remote Java Application" in the launch types pane on the left and update the connection properties on the right to use port 55000. You should connect up the debug launcher with a project as well, to pick up that project's class path and sources.
Note I haven't actually tried this in postgresql, but this corresponds to how I always used to run JBoss from a shell script rather than from within Eclipse.
I needed a slight change to the option line. The working one is-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=localhost:8000. Without the server=y part, the debugger complains about missing transport. With the above, everything worked.