Ivo
Ivo

Reputation: 25

How to embed in HTML a Java app whose main class is not in the JAR's main directory?

I have been working on an Intranet portal for my company and, recently, the project coordinator requested to add a way to connect to the internal servers via SSH through the portal. Questions aside how useful that would be, I have found a Java app to be the only reliable way to do so, and I have settled with JTA

Problem is that I can't seem to find a way to embed it properly in HTML.

This is what I started with:

<object type="application/x-java-applet" height="300" width="550">
  <param name="code" value="Main" />
  <param name="archive" value="jta25b.jar" />
  <p>Applet failed to run.  No Java plug-in was found.</p<
</object>

Being the param "code" the name of the Main.class that is listed on the Manifest file. The problem is that said Main.class is inside three subdirectories from the JAR's root, specifically "de/mud/jta/Main.class".

Then I found out about a param "codebase" that would in theory allow me to pinpoint the class' location, but I'm not even entirely sure that's how codebase is supposed to work since documentation regarding its use is pretty sparse. Either way, adding this line to the object element has not solved the issue:

  <param name="codebase" value="de/mud/jta/" />

So, while I haven't tackled with Java in a long time I have considered installing Netbeans to try and change the classes paths to make the app work from its root folder. A better solution would be much appreciated, though.

Upvotes: 0

Views: 111

Answers (1)

Richard Neish
Richard Neish

Reputation: 8806

de/mud/jta is the path to the Java package for the Main class. So the value of the code param should be de.mud.jta.Main

Upvotes: 1

Related Questions