Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Linux Tools Project » Java App in Container(How to use this run configuration)
Java App in Container [message #1821329] Mon, 10 February 2020 22:11 Go to next message
Izaak de Hullu is currently offline Izaak de HulluFriend
Messages: 3
Registered: February 2020
Junior Member
I saw this option inside the run configurations. It looks like I can run a java application application inside a docker container from the IDE. What I assume is that this concerns a simple java app (a jar) that can run inside a docker container with a JRE installed.

I cannot find anything in the manual concerning this nice feature. So how do I use this?

In the main tab, I selected the project and the main java class. Then there is an image tab but I do not completely understand what kind of image I need to supply. Obviously it needs to contain a java JRE but what else ?!? Is there a sample Dockerfile I could use to construct an image that works.

Furthermore I can select 'Additional directories' but what does that mean?

Well if I just select an openjdk base image it does not work (as I would expect). It tries to construct a command line... but it fails and returns me the following error:
invalid environment variable =::=::\\


Inside the Error.log I can find:
java.io.IOException: Cannot run program "/bin/true": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at java.lang.Runtime.exec(Unknown Source)
	at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:935)
	at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:885)
	at org.eclipse.debug.core.DebugPlugin.exec(DebugPlugin.java:863)
	at org.eclipse.jdt.launching.AbstractVMRunner.exec(AbstractVMRunner.java:79)
	at org.eclipse.linuxtools.jdt.docker.launcher.ContainerVMRunner.exec(ContainerVMRunner.java:97)
	at org.eclipse.jdt.internal.launching.StandardVMRunner.run(StandardVMRunner.java:502)
	at org.eclipse.linuxtools.jdt.docker.launcher.JavaAppInContainerLaunchDelegate.launch(JavaAppInContainerLaunchDelegate.java:237)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:860)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:719)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1017)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$2.run(DebugUIPlugin.java:1220)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessImpl.create(Native Method)
	at java.lang.ProcessImpl.<init>(Unknown Source)
	at java.lang.ProcessImpl.start(Unknown Source)



By the way, I am running Eclipse IDE for Enterprise Java Developers. Version: 2019-12 (4.14.0) Build id: 20191212-1212 on Windows 10

If somebody could point me in the right direction preferably with a sample Dockerfile and configuration that would be of great help.
Re: Java App in Container [message #1821339 is a reply to message #1821329] Tue, 11 February 2020 09:03 Go to previous messageGo to next message
Izaak de Hullu is currently offline Izaak de HulluFriend
Messages: 3
Registered: February 2020
Junior Member
Looking in the source code I see at the end of the ContainerVMRunner class I see it does a:
return super.exec(new String [] { "/bin/true" }, null);


But this sounds very Linux and not Windows....

Is Java App in Container not supported in windows?
Re: Java App in Container [message #1821425 is a reply to message #1821339] Wed, 12 February 2020 20:28 Go to previous message
Jeff Johnston is currently offline Jeff JohnstonFriend
Messages: 215
Registered: July 2009
Senior Member
Izaak,

Containers are Linux so the /bin/true command should run in the container, not Windows. According to the developer who created the feature, he tested using a base Fedora image (e.g. Fedora 26) and ran the following dockerfile:

FROM fedora:26
RUN dnf install -y java-devel && dnf clean all
Previous Topic:Valgrind on Eclipse 4.9 Error
Next Topic:Please help me
Goto Forum:
  


Current Time: Thu Apr 25 03:35:23 GMT 2024

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

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

Back to the top