java


java.lang.NoClassDefFoundError with external jars in java applet


I have a Java applet which utilizes multiple external jars. In Eclipse the project runs fine. When it is exported and run embedded in a HTML file I get 22 run-time exceptions similar to..
java.lang.RuntimeException: java.lang.NoClassDefFoundError:
mil/dcgs/mdf/webservice/ddms/ingest/CatalogIngestService
..with various classes. When I open the exported jar I see no .class files or any other traces from the external jar.
HTML
The HTML is:
<html>
<head>
<title>DIB Applet</title>
</head>
<body>
<applet
code="org.mitre.inception.Main.class"
archive="inception.jar"
WIDTH = "1020"
HEIGHT = "500">
Applet
</applet>
</body>
</html>
.classpath
My .classpath looks like the following.
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="C:/Users/myUserName/Desktop/jars/dcgs-util.jar"/>
<!-- more jars removed for space reasons as they look the same as above -->
<classpathentry kind="output" path="bin"/>
</classpath>
The classpath mentions dcgs-util.jar. That should probably be listed in the archive attribute of the applet element. Perhaps something like:
<html>
<head>
<title>DIB Applet</title>
</head>
<body>
<applet
code="org.mitre.inception.Main.class"
archive="inception.jar,jars/dcgs-util.jar"
WIDTH = "1020"
HEIGHT = "500">
Applet
</applet>
</body>
</html>
That would be assuming inception.jar was in the same directory as the HTML, and that dcgs-util.jar is in the jars sub-directory of the dir. where the HTML is located.
Try by using the following classpath. I just changed the order of the jar files.
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="C:/Users/myUserName/Desktop/jars/dcgs-util.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<!-- more jars removed for space reasons as they look the same as above -->
<classpathentry kind="output" path="bin"/>
</classpath>

Related Links

Are there any Java VMs which can save their state to a file and then reload that state?
Spring and Hibernate, Lazy initiation problem
How to convert a string into TimeSeriesDataItem
GUI: Changing panels based on value of combo box
Runtime.getRuntime().exec(), hide the console screen
Type mismatch with generics
Calculate the display width of a string in Java
What is the difference between a Functor and the Command pattern?
IE Browser hangs after opening a file dialog. Workaround?
Is a Java interface an abstract class?
How do you get Java sockets working with public IPs?
Recommended Java/AJAX design pattern?
Data structure for soundex algorithm?
Writing long test method names to describe tests vs using in code documentation
How do you remove rows after changing the item in a JPA OneToOne relationship?
Determining Current Call Stack (For Diagnostic Purposes)

Categories

HOME
sendgrid
yii2
bluetooth
dictionary
nullpointerexception
cplex
jira
cakephp-2.5
win32gui
elasticsearch-hadoop
iggrid
vault
google-cloud-ml
try-catch
propel
undefined
text-rendering
swiftlint
tibco-mdm
wijmo
kannel
windows-error-reporting
fifo
xacml
kendo-datasource
file-rename
skia
key-value-observing
noraui
atl
plsql-psp
main
bitbucket-pipelines
impersonation
ncalc
grid.mvc
janrain
node-gyp
nand2tetris
babel-core
long-polling
dotnetzip
crypt
google-perftools
sybase-asa
r-forge
spring-cache
blacklist
crosswalk-runtime
time-and-attendance
wdf
nxt
removechild
bonobo
file-writing
trash
simplewebrtc
qcustomplot
master-slave
oauth2client
xpath-1.0
hsv
separator
t4mvc
quicklisp
kcachegrind
riak-cs
microbenchmark
vstest.console.exe
apache-commons-net
document-classification
terminfo
sgen
starcluster
poller
didselectrowatindexpath
typo3-neos
openlaszlo
quartz-graphics
flash-builder4.5
eclipse-memory-analyzer
padarn
plasma
selected
rdoc
bluepill
ticoredatasync
nsmanagedobject
krl
winbugs14
mongomapper
nhibernate.search
bespin
thread-local-storage
private-members
rtml
uiq3
misv

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App