Re: java -jar runs the application but not Java Web Start
Dec 16, 2003 1:39 PM
(reply 17
of 20) (In reply to
#16 )
The problem is now listed as as bug #4968627. You can see the progress/vote for it at:
http://developer.java.sun.com/developer/bugParade/bugs/4968627.html
Re: java -jar runs the application but not Java Web Start
Sep 14, 2004 12:10 PM
(reply 20
of 20) (In reply to
#19 )
Hi
I met a similar problem before. The java web start failed to load anonymous inner classes from a jar file for an applet.
After several tests, finally, I solved this problem.
What I did was:
put all the class names in an array of strings and load these classes to JVM by a class loader. remember, the outer class should be loaded before its anonymous inner classes are loaded.
For example:
public class LongTask
{
private int lengthOfTask;
private int current = 0;
private String statMessage;
public static final String[] CLASSLIST =
{
"Logon",
"Logon$1",
"Logon$2",
"Logon$3",
"Logon$4",
"Logon$5"
};
LongTask()
{
lengthOfTask = CLASSLIST.length;
}
void go()
{
current = 0;
final SwingWorker worker = new SwingWorker()
{
public Object construct()
{
return new ActualTask();
}
};
worker.start();
}
/------------------------------------------------------------- Called from ProgressBarDemo to find out how much work needs to be done.
-------------------------------------------------------------/
int getLengthOfTask()
{
return lengthOfTask;
}
/---------------------------------------------------------------- Called from ProgressBarDemo to find out how much has been done.
----------------------------------------------------------------/
int getCurrent()
{
return current;
}
void stop()
{
current = lengthOfTask;
}
/------------------------------------------------------------------ Called from ProgressBarDemo to find out if the task has completed.
------------------------------------------------------------------/
boolean done()
{
if (current >= lengthOfTask)
return true;
else
return false;
}
/----------------------------------------------------------------- The actual long running task. This runs in a SwingWorker thread.
-----------------------------------------------------------------*/
class ActualTask
{
ActualTask ()
{
Class tempClass = null;
ClassLoader myLoader = Thread.currentThread().getContextClassLoader();
while (current < lengthOfTask)
{
try
{
tempClass = myLoader.loadClass(CLASSLIST[current]);
synchronized(this)
{
current ; //make some progress;
statMessage = "Completed " current
" out of " lengthOfTask ".";
}
}
catch (InterruptedException ie) {}
}
}
}
}
This topic has
20
replies
on
2
pages.
« Previous |
1
|
2
|