How to run an applet like a desktop application without installing entire JDK?

I want to make a desktop application- an analog-clock with the option of setting alarms using java. For rendering all the graphics and the button features, a Swing applet is the answer.

But the problem is that I want to run the applet onto the desktop and so need an applet viewer like thing. Applet viewer comes with the JDK and I think installing entire JDK on a system for running just a simple alarm clock is really not a good idea at all because it will take a lot of space.

Is there a way out? Can I get just the applet viewer (or anything similar to that) instead of entire JDK so that I can run my applet? Or is there any other way I can do my project using Java?

5

You need appletviewer to debug java applets, if you want just to run them you need a Java Runtime Environment (JRE) and the Java plugin for your favourite browser.

But if you just need a clock, you can do it just with javascript and HTML5:
http://www.neilwallis.com/projects/html5/clock/index.php

5

I’m reluctant to post this an answer however there isn’t really any way of doing what you want. There is no way around it as the Java code needs the JVM to execute. Well, there is one way around it and that is to use a Java to EXE compiler such as Excelsior. I don’t know too much about it other than it can take your Java code and once you have ran it through their compiler you are left with a native exe (I’m assuming you mean windows) that does not rely on a JVM.

Just to expand, I’m not really a Java developer so I’m unsure of how many other tools there are that do what Excelsior JET do; however do be careful as many Java-To-EXE tools don’t actually compile your code into a native PE binary, but simply wrap your .jar file into an EXE and still require a JVM to run.

1

To run any Java code, one needs the JVM (Java Virtual Machine) installed on the system. On most systems, this is installed as part of the the JRE (Java Runtime Environment). Developers typically install the JDK (Java Development Kit) which is a superset of the JRE that also includes compilers, debuggers, and associated tools.

Looking at Java SE Technologies at a Glance from Oracle, one can see the additional tools that are part of the JDK that do not come with the JRE.

Applets are part of the applet runtime plugin, the AppletViewer is part of the JDK. One does not need the JDK to see an applet if the applet is hosted on a web page.

If this does not need to be part of a web page, one should instead consider using a stand alone environment that is part of the Java SE world. Swing is under the “User Interface Libraries” in the chart on the oracle page which falls under the JRE.

Writing for a stand alone Java SE (rather than an applet) should make this easier to build and run. See Java : Swing application on Wikipedia to get a very basic idea of a hello world app using this framework. Note in particular the public static void main(final String[] args) { ... } method that exists within the class – this is how one invokes a Java SE application.

If one wanted to avoid needing a separate install of a JVM, it is possible though this comes with various restrictions. The most well known of these is the commercial Excelsior package (its not exactly ‘inexpensive’). Excelsior compiles to native code and includes a runtime (the JET runtime) that is capable of dynamically loading other .class files. There also exists gcj, though it appears to be… stale and without any recent (four years) updates. Please read the status page and note that it likely won’t fit your needs (java.awt: A lot of code exists, but not enough for use in real applications.)

If you are going to write a java application, your best bet is to have the JRE (one doesn’t need the full JDK) on the target machine and build for that. The JRE isn’t that big and may very well already be on the target machines.

5

For applet to run without JDK ie not through appletviewer you can follow these steps –

  1. Embed it in HTML using applet tag –
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
applet ARCHIVE="jar file or external jar files if any" code ="class name with .class extn" width = 800 height =500>
applet ARCHIVE="jar file or external jar files if any" code ="class name with .class extn" width = 800 height =500>
applet ARCHIVE="jar file or external jar files if any" code ="class name with .class extn" width = 800 height =500> 
  1. Create jar file for your code.
  2. Sign all your jar files using jarsigner
  3. Run your HTML file with JRE installed for browsers

you can view your applet in browser with this anywhere.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật