How to allow a Java application to run on any PC without installing jdk?
I'm doing this program that would retrieve infomation of the PC and send it to the server. In order to do that, i have to email the application to all these PCs. The problem is that some of these PCs may not have JRE or jdk to run the application. Cos, i thought that Java was Write once Run anywhere. I've tried to jar and run it on a PC with no JRE and stuff, How can this be done, I know that using applet is an option, but is there any other way. Pls help me, thanx!
you need a java virtual machine to run a java application, either it is embedded in the browser ( a native or plug-in ) and you can run your applet in the browser, or, if you don't want your app to be an applet, you have to install a jre on the PC...no other way, i'm afraid
so write once, run anywhere, provided there's a jre anywhere ! it is the jvm that handles differences between os, and you need to handle that difference somewhere, don't you !
Similar Messages
-
How to decomplie a java class file when java application is running/launch?
I have a simple java application with some components being displayed, now i need to get the components instance names that are been created in that java application. How do i do that?
Eg: Button b1 = new button();
now how to write a java application to decompile this class file & return me the button instance ie "b1".I think you wanna do two different things:
1. find out which objects were created at runtime.
2. decompile class file.
I'm no so sure why.
have you tried insrospecting the class using reflection ?
Here is a code snippet that prints class field names.
try{
Class c = Class.forName("MyClass");
java.lang.reflect.Field[] f= c.getFields();
for (int i = 0;i<f.length; i++)
System.out.println(f.getName());
catch(Exception e){ }
Regards
Joseph. -
How to make a Java application that will change the client box's IP address
HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )
If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.
-
How to ran a java application with out console?
Hi
I have developed several applications using java. I'm trying to run them on windows platform. The way I run them now is by openning a CMD window and by typing java -jar myjarfilename.jar
This way cmd window remains on windows taskbar/desktop untill I close the java application.
Is there any other way to run .jar files on windows?. Am I using a wrong compilation tool?
Basicaly is there a way to run an application developed using java or .jar files like a normal win32 application (By dobble clicking on an icon)
Please help.
Thanks.If you install the JRE, it associates itself with jar files, thus allowing you to double click on them to run. Other than that, if you want to be able to double click on an app for it to run, you will have to write a native wrapper around the JVM.
Now, to run your app. making the command window dissapear, all you need to do is invoke the command with javaw.exe, instead of java.exe (notice the W in the first .exe). This runs java without a command window. If you still have your command window appear, prepend "start" to the call to javaw.exe. E.g.:
start javaw.exe -jar myjar.jar
HTH,
Manuel Amago. -
How to schedule a java application via Windows Scheduler
I can't figure out how to schedule a java application using the Windows Scheduler. Do I schedule the java application with the .class file as a parameter? How do I pass arguments to it?
To execute FileCopy.class, my best guess was:
Start | Control Panel | Performance and Maintenance | Scheduled
Tasks | Add Scheduled Task | Browse | Program Files | Java |
jre1.5.0_06 | ... Advanced Properties
Under the Task tab:
Run: "C:\Program Files\Java\jre1.5.0_06\bin\java.exe"
Start In: "MyDocuments\Eclipse_Workspace\Java_File_Copy
FileCopy"
This does not work. How do I schedule the FileCopy.class java application, and how can I pass arguments to it? Can this be done without specifying a password?
TIA,
JohnSuppose that your class is FileCopy (has no package name) and is located under MyDocuments\Eclipse_Workspace\Java_File_Copy folder, then you should have:
Run: "C:\Program Files\Java\jre1.5.0_06\bin\java.exe" FileCopy
Start In: "MyDocuments\Eclipse_Workspace\Java_File_Copy"
And yes you must provide a user password to execute the task.
Best way to do this is to create a special user (with password) for executing this task.
Regards -
I have a program that requires Java 6. I am running 10.8.2, How do I remove Java 7 to run this program?
Try going to the Oracle site - they did have a page showing how to remove Java 7 using the terminal program.
I followed their instructions and it didn't work for me, but you may have better skills and luck than I.
This was my starign point;
http://www.java.com/en/download/help/mac_uninstall_java.xml
Let us know if this works. -
How do i see what applications are running in the background
My iMac is running very slow my operating system is OS X Yosemite Version 10.10.2 with a 2.5 GHz Intel Core i5 Processor. How do I see what applications are running in the background?
Reinstalling OS X Without Erasing the Drive
Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
Reinstalling OS X Without Erasing the Drive
Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
When the recovery menu appears select Disk Utility and press the Continue button. After Disk Utility loads select the Macintosh HD entry from the the left side list. Click on the First Aid tab, then click on the Repair Disk button. If Disk Utility reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit Disk Utility and return to the main menu.
Reinstall OS X: Select Reinstall OS X and click on the Continue button.
Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.
Alternatively, see:
Reinstall OS X Without Erasing the Drive
Choose the version you have installed now:
OS X Yosemite- Reinstall OS X
OS X Mavericks- Reinstall OS X
OS X Mountain Lion- Reinstall OS X
OS X Lion- Reinstall Mac OS X
Note: You will need an active Internet connection. I suggest using Ethernet
if possible because it is three times faster than wireless. -
When trying to install Reader 9.2 updates it wants me to close applications that are using reader. There is nothing listed and no applications are running. Any ideas?
Make sure your browser is closed and check to see if there are any processes related to Acrobat still running. If you are using Windows, Control-Alt-Delete > Processes tab. Look for AcroRd32.exe or Acrobat.exe or Acrotray.exe and stop these processes from running before you try your update again. A good ol' computer reboot might do the trick for you too.
-
How to disable my java application after a few days
I have a java application as a MyApplication.jar file. On clicking this .jar my application starts. I want to distribute this jar to my friends so that they can run the application and use it. However, I want my application to run only for a few days. The jar should become unusable after say 10 days and no one (including the people holding the jar) should be able to execute it.
>
...I want to distribute this jar to my friends so that they can run the application and use it. However, I want my application to run only for a few days. >Just a wild guess. You don't have many friends*, do you?
In any case, the usual way to approach this task is to write a key to the system that contains the first date the software was run, then check it each subsequent launch. If the 'first date' + 'allowable days' is before 'today', pop a message telling the user that the software has expired.
As to how/where to store this information..
You might use the Properties class to read/write the date property.
Problems with this approach are
a) Users adjusting their system clock to a previous date to get software to work again.
b) Users finding and deleting the file containing the 'first date' property.
c) Users leaving the software running for 173 consecutive days.
d) * Users hating the software so much that they come and burn your house down.
( That last one is the real worry. ;) -
How to launch my java application in a web browser?
Hi. I try to launch my java application, e.g. "HellowWorld.java", using web browser.
1. How can I change my java application program to java applet in general way?
I read "Java: An Introduction to Computer Science and Programming, Third Edition"
by Walter Savitch and found page 803 - "Converting a Swing application to an applet".
My question is how I can know which class should be removed or not such as using JApplet instead of JFrame. Are there general rules about this?
2. I found "AWT only" tutorial had some example lauching application using "AppletButton".
How can I use this method to launch "HelloWorld.class"?
http://java.sun.com/docs/books/tutorial/information/download.html#OLDui
(after extracting zip file) -> ../OLDui/layout/card.html
3. (continued 2) Can I use above method to embed applet into web browser?
For example, java Swing application -> applet using "AppletButton" -> web browser using "<applet></applet>" tag.
I'd appreciate any partial anwers of these questions or other suggestions.
Thanks.Thanks! Here is what I got from your help.
* HelloWorldSwing.java is a 1.4 example that
* requires no other files.
import javax.swing.*;
import java.awt.*; //for Container class
// public class HelloWorldSwing {
public class HelloWorldSwingToApplet extends JApplet {
* Create the GUI and show it. For thread safety,
* this method should be invoked from the
* event-dispatching thread.
// private static void createAndShowGUI() {
private void createAndShowGUI() {
//Make sure we have nice window decorations.
// JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
// JFrame frame = new JFrame("HelloWorldSwing");
// frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container frameApplet = getContentPane();
//Add the ubiquitous "Hello World" label.
JLabel label = new JLabel("Hello World");
// frame.getContentPane().add(label);
frameApplet.add(label);
//Display the window.
// frame.pack();
// frame.setVisible(true);
public void init() {
createAndShowGUI();
/* public static void main(String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
} -
How to deploy my Java application?
Have a proxy server running as a plain vanilla Java application from the DOS command line in Windows. Would like to run it 'properly' on a (web) server. Have got Apache and Tomcat installed but I don't know how to adapt my application to run in that environment. The proxy server maintains a socket connection from another backend machine and pushes information from there to a client that connects to the proxy server.
Well what's confusing is your use of "maintains", in "maintains a socket channel". That's largely counter to the design of the HTTP protocol. So I can't tell if you're using HTTP incorrectly or just describing it counter-intuitively.
If you're opening a socket from the client and keeping it open indefinitely to maintain a kind of session, then you're not really using HTTP right and you can just drop that.
If you really are using a series of HTTP connections, then Apache/Tomcat would be a fine thing.
If all you're doing is an ordinary proxy server, then actually Apache can handle that all by itself with no java code at all.
If your code is acting as a real HTTP server, then removing the web server parts, letting Apache handle that, and using Tomcat as a servlet environment would be very good. You'd be implementing only the business logic, not the standard plumbing stuff.
Have you ever written any servlets or other J2EE stuff? -
How to deploy a java application -- might be silly but just help me out
Hi I�ve developed a java application in eclipse. How do I deploy it so that it can be used by others without the help of eclipse? I can run it in eclipse but how do I deliver it to my customers and how can they use it without the help of eclipse or using java runtime commands. Please give me some pointers on this.
Eclipse can help you to build a jar file for you.
See: File>Export ...>Java>Jar File
Don't forget to stick a Manifest file in that jar which points the JVM to
the class that contains the static main() method.
kind regards,
Jos -
How to execute a java application once the server starts
I have created a java application which executes correctly. I want this application to execute everytime I start my server. I have modified my web.xml as shown below
<servlet>
<servlet-name>SendEmail</servlet-name>
<servlet-class>
com.allcorp.alliance.tdocs.servlets.SendEmail</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
<load-on-startup>1</load-on-startup>
</init-param>
</servlet>
I have extended the class with HttpServlet. When I start the server, I get the message saying the class is being initializing but it does not execute. I want the application to execute. Any idea what I need to do.BalusC wrote:
Implement ServletContextListener and run the appplication on creation of the ServletContext.Well i understand implementation of ServletContextListener and by overiding contextInitialized(ServletContextEvent se) accordingly can solve the problem.
but you need to consider two cases here first
1).ServletContextListener is not supported by all container especially the minor onces which does not support Servlet 2.3 specification.
2).OP does not have any idea of how to use a Servlet first if you can see he had written his intialization code in the main method.Now how can you expect him to create a listener..... :)
I hope there are no hard issues on what i said this time.
*@OP*
My friend the bad news is that you need to spend bit of time learning about servlets.U'd not be writing intialization code inside a main rather you'd be doing it inside public void init(ServletConfig config) method.
by making <load-on-startup><!--value</load-on-startup> in web.xml enables Servlet container to call init method at the time of deployment of the web application else where it'd call the init method whenever servlet encounters first request from a client.
package com.allcorp.alliance.tdocs.servlets;
import java.util.*;
import javax.mail.*;
import javax.mail.internet.*;
import javax.servlet.http.*;
import javax.servlet.*;
import javax.activation.*;
* @author ssa3z
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class SendEmail extends HttpServlet{
public void init(ServletConfig config) {
// SUBSTITUTE YOUR EMAIL ADDRESSES HERE!!!
String to = "[email protected]";
String from = "[email protected]";
// SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
String host = "smtp.allstate.com";
// Create properties, get Session
Properties props = new Properties();
// If using static Transport.send(),
// need to specify which host to send it to
props.put("mail.smtp.host", host);
// To see what is going on behind the scene
props.put("mail.debug", "true");
Session session = Session.getInstance(props);
try {
// Instantiatee a message
Message msg = new MimeMessage(session);
//Set message attributes
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Test E-Mail through Java");
msg.setSentDate(new Date());
// Set message content
msg.setText("This is a test of sending a " +"plain text e-mail through Java.\n" +"Here is line 2.");
//Send the message
Transport.send(msg);
}catch (MessagingException mex) {
mex.printStackTrace();
} Hope this might help :)
REGARDS,
RaHuL -
How to call a java application in a jar which is in a war file of a ear ?
So sorry to cross post, but no response in other topics.....
Please help!
I have a Ear file which contains a war file.
xx.ear/META-INF
xx.ear/YY.war
and the YY.war has the following structure:
YY.war/META-INF
YY.war/WEB-INF
YY.war/WEB-INF/classes
YY.war/WEB-INF/classes/com/
YY.war/WEB-INF/classes/com/mycompany/
YY.war/WEB-INF/classes/com/mycompany/MyClass.class
MyClass.class is a java application which has a main method.
how can I call this MyClass applicaiton from the xx.ear??
java -???? com.mycompany.MyClass ??
Please help because I have a Unix cron job need to access this class externally outside AppServer. Thx!!an ear file is a standard jar with a different extension. You may
be able to get away with just adding a manifest file to it that
specifies the main class (make it an executable jar with a different
extension).
I don't know if this will handle the nested war file though. It may.
matfud -
How to download IMExample java application??
Hi all,
I need to research Multimedia database in Oracle. I tried to find and to download IMExample Java application. but I don't know where I can find the IMExample in Oracle database.
Please, any one can help me where I can download IMExample Java application ???
Thanks alot !!Hi
I have such problem
I must make database which store monkey's audio audio file (*.ape)
but Intermedia support only such file:
# This file controls what MIME types are sent to the client for the
# given file extensions. Sending the correct MIME type to the client
# is important so they know how to handle the content of the file.
# Extra types can either be added here or by using an AddType directive
# in your config files. For more information about MIME types
# please read RFC 2045, 2046, 2047, 2048, and 2077.
# MIME type Extension
application/activemessage
application/andrew-inset
application/applefile
application/atomicmail
application/dca-rft
application/dec-dx
application/mac-binhex40 hqx
application/mac-compactpro cpt
application/macwriteii
application/msword doc
application/news-message-id
application/news-transmission
application/octet-stream bin dms lha lzh exe class
application/oda oda
application/pdf pdf
application/postscript ai eps ps
application/powerpoint ppt
application/remote-printing
application/rtf rtf
application/slate
application/smil smi smil sml
application/wita
application/wordperfect5.1
application/x-bcpio bcpio
application/x-cdlink vcd
application/x-compress
application/x-cpio cpio
application/x-csh csh
application/x-director dcr dir dxr
application/x-dvi dvi
application/x-gtar gtar
application/x-gzip
application/x-hdf hdf
application/x-javascript js
application/x-koan skp skd skt skm
application/x-latex latex
application/x-mif mif
application/x-netcdf nc cdf
application/x-sh sh
application/x-shar shar
application/x-stuffit sit
application/x-sv4cpio sv4cpio
application/x-sv4crc sv4crc
application/x-tar tar
application/x-tcl tcl
application/x-tex tex
application/x-texinfo texinfo texi
application/x-troff t tr roff
application/x-troff-man man
application/x-troff-me me
application/x-troff-ms ms
application/x-ustar ustar
application/x-vnd.realmedia rm
application/x-vnd.realtext rt
application/x-wais-source src
application/zip zip
audio/basic au snd
audio/midi mid midi kar
audio/x-mpeg mpga mp2 mp3
audio/x-aiff aif aiff aifc
audio/x-pn-realaudio ram
audio/x-pn-realaudio-plugin rpm
audio/x-realaudio ra
audio/x-wav wav
audio/x-ms-wma wma
audio/x-ms-wax wax
chemical/x-pdb pdb xyz
image/bmp bmp
image/gif gif
image/ief ief
image/jpeg jpeg jpg jpe
image/pict pict pct
image/png png
image/tiff tiff tif
image/x-cmu-raster ras
image/x-portable-anymap pnm
image/x-portable-bitmap pbm
image/x-portable-graymap pgm
image/x-portable-pixmap ppm
image/x-rgb rgb
image/x-xbitmap xbm
image/x-xpixmap xpm
image/x-xwindowdump xwd
message/external-body
message/news
message/partial
message/rfc822
model/iges igs iges
model/vrml wrl vrml
model/mesh msh mesh silo
multipart/alternative
multipart/appledouble
multipart/digest
multipart/mixed
multipart/parallel
text/css css
text/html html htm
text/plain txt
text/richtext rtx
text/tab-separated-values tsv
text/x-setext etx
text/x-sgml sgml sgm
text/xml xml dtd
video/mp4 mp4
video/3gpp 3gp
video/mpeg mpeg mpg mpe
video/quicktime qt mov
video/x-msvideo avi
video/x-ms-asf asf asx
video/x-ms-wmv wmv
video/x-ms-wvx wvx
video/x-sgi-movie movie
x-conference/x-cooltalk ice
There is no ape file, how can I add the new format *.ape
"Extra types can either be added here or by using an AddType directive" ??? how can I do it ?
Thanks
Maybe you are looking for
-
I cannot send emails on iPad 2 or iPhone 4s.
Cannot send emails on iPad 2 or iPhone 4S. I keep getting an error saying you have exceeded your sending limit. Messages just sit in the outgoing box. How do I resolve this and avoid it in the future.
-
Vo Substitution - not working on one client machine
recently deployed a standard VO substitution for a simple table region. I also added (via personalization) an additional column with a MessageStyledText region. I deployed the new code, used the JDev jpximport.bat to deploy the substitution, and boun
-
my battery has not held a charge for some time, and when i moved my laptop, i realized that the battery back itself is coming unsealed at the edges, and no longer actually goes in properly. is it going to leak or burn? is this a heat related problem,
-
IPhone versus iTouch versus G1
I really love my G1 but am going back and forth as to whether to cancel my contract with T-Mobile, take the early termination hit but can make it back easily by selling the G1 online. Then I can pickup an iPhone and have an all-in-one product. I curr
-
I just recently got FIOS and everything has been good until tonight. It seems after about 7pm my speeds have been dropped dramtically from 25/5 too 1/5 My computer is not the issue I have already tried rebooting the modem multiple times The slow spe