When I try to run my applet on the server, it never seems to go out the first step, that is, loading libraries, and when I try to run on localhost, works perfectly
CODE
private final static String DEFAULT_DOWNLOAD_PATH = "http://colorfulwolf.com/dev/cam/";
private final static String VERSION_ID = "1.0.0";
// note that this list is windows-specific, so this is not a generic
// solution that works on all OSes
private final static String[] LIBS = { "cv210.dll", "cvaux210.dll",
"cxcore210.dll", "cxts210.dll", "highgui210.dll", "ml210.dll" };
private final static String LIB_ARCHIVE = "opencv21.zip";
public void loadWebcam() {
loadingScreen.setMaxProgress(7);
loadingScreen.setProgress(1, "Loading Librarys..");
String tmpDir = System.getProperty("java.io.tmpdir");
File faPath = new File(tmpDir + File.separator + "WebcamApplet_"
+ VERSION_ID.replaceAll("\\.", "-"));
System.out.println(faPath);
System.setProperty("jna.library.path", faPath.getAbsolutePath());
String downloadPath = this.getParameter("dll_path");
if (downloadPath == null)
downloadPath = DEFAULT_DOWNLOAD_PATH;
try {
prepareLibraries(faPath, downloadPath);
} catch (Exception e) {
e.printStackTrace();
loadingScreen.setProgress(3, "Erro: " + e.getMessage());
return;
}
}
private void prepareLibraries(File localPath, String downloadPath)
throws Exception {
if (localPath.exists()) {
boolean libMissing = false;
for (String lib : LIBS) {
File libFile = new File(localPath.getAbsolutePath()
+ File.separator + lib);
if (!libFile.exists()) {
libMissing = true;
break;
}
}
if (!libMissing)
return; // We don't have to download
}
if (!localPath.exists() && !localPath.mkdirs()) // Error fatal!
throw new Exception("Can't create the path: " + localPath);
loadingScreen.setProgress(2, "Downloading library...");
File file = new File(localPath.getAbsolutePath() + File.separator
+ LIB_ARCHIVE);
String link = downloadPath + LIB_ARCHIVE;
download(link, file);
ZipFile zipFile = new ZipFile(file);
Enumeration<? extends ZipEntry> entries = zipFile.entries();
loadingScreen.setProgress(3, "Installing librarys..");
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
if (entry.isDirectory())
continue;
File tar = new File(localPath.getAbsolutePath() + File.separator
+ entry.getName());
InputStream is = zipFile.getInputStream(entry);
OutputStream os = new FileOutputStream(tar);
copyStream(is, os);
os.flush();
os.close();
is.close();
}
zipFile.close();
file.delete();
if (file.exists())
file.deleteOnExit();
}
I put the jar files on the server in a visible HTTP
path
<applet code="com.colorfulwolf.webcamapplet.WebcamApplet"
archive="http://www.netimoveis.com/teste.jar, http://www.netimoveis.com/core.jar, http://www.netimoveis.com/javacv.jar, http://www.netimoveis.com/javase.jar, http://www.netimoveis.com/jna.jar, http://www.netimoveis.com/customizer.jar, http://www.netimoveis.com/jmf.jar, http://www.netimoveis.com/meidaplayer.jar, http://www.netimoveis.com/multiplayer.jar, http://www.netimoveis.com/sound.jar"
height="550" width="550">
</applet>
Why when I try to run the applet on the server, it does not leave the first step?
@UPDATE
I found the line where the code don't move to the next line of code.
String tmpDir = System.getProperty("java.io.tmpdir");
this line is where my code stop and still just in this line. Java is currently installed in server.
jar
. – FinsenSystem.getProperty()
can throw aSecurityException
aNPE
or aIllegalArgumentException
as you can see – Dacycom.colorfulwolf.webcamapplet
,com.colorfulwolf.webcamapplet.gui
,com.google.zxing
,com.google.zxing.client.j2se
. My applet runs in a classe that are in mycom.colorfulwolf.webcamapplet
package. I need put the another packages in mycode
attribute in<applet>
tag? – FinsenSystem.getProperty()
? How did you come to such a conclusion? It'd be a very strange thing indeed – DacyJOptionPane
after this line and didn't pass, and didin't pass in acatch
statement. – Finsen