473,804 Members | 3,809 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

miffed and need help to run application

gg
I was playing with some free java code but I was miffed.

In the current working directory, I have xyz.jar and a subdirectory
coresrvlets. The classes of the package coreservlets are naturally all in
the subdirectory coreservlets. Furthermore xyz.jar has the library that some
of the coreservlets classes may cay on.

I can't run the ShadowedTextFra me class from the current directory with
java -classpath .;xyz.jar coreservlets\Sh adowedTextFrame
nor
java -classpath .;xyz.jar;cores ervlets coreservlets\Sh adowedTextFrame

( I get something like
Exception in thread "main" java.lang.NoCla ssDefFoundError :
coreservlets\Sh adowedTextFrame (wrong name: coreservlets/ShadowedTextFra me)
at java.lang.Class Loader.defineCl ass0(Native Method)
at java.lang.Class Loader.defineCl ass(ClassLoader .java:486)

)
However, I could run an applet which calls the above ShadowedTextFra me from
the current directory like this
appletviewer ShadowedText.ht ml
where ShadowedText.ht ml has an applet tag like this
<applet
code=coreservle ts\ShadowedText Applet.class
name=ShadowedTe xtApplet
archive=xyz.jar
width=320
height=300 >
<param name="MESSAGE" value="TEST text shadow">

</applet>
What do I need to do so I can run the ShadowedTextFra me class directly with
the java command?
ShadowedTextFra me.java looks to me perfectly like a regular swing java
application to me with its main. and the source code is as follows

The package coreservlets;

import java.awt.*;
import javax.swing.*;
import java.awt.geom.* ;

import java.awt.event. *; // for the listeners
/** Interactive interface to MessageImage class.
* Enter message, font name, and font size on the command
* line. Requires Java2.
* <P>
* Taken from Core Servlets and JavaServer Pages
* from Prentice Hall and Sun Microsystems Press,
* http://www.coreservlets.com/.
* &copy; 2000 Marty Hall; may be freely used or adapted.
*/

public class ShadowedTextFra me extends JPanel {
private Image messageImage;

public static void main(String[] args) {
String message = "Shadowed Text";
if (args.length > 0) {
message = args[0];
}
String fontName = "Serif";
if (args.length > 1) {
fontName = args[1];
}
int fontSize = 90;
if (args.length > 2) {
try {
fontSize = Integer.parseIn t(args[2]);
} catch(NumberFor matException nfe) {}
}
JFrame frame = new JFrame("Shadowe d Text");
frame.addWindow Listener(new ExitListener()) ;
JPanel panel =
new ShadowedTextFra me(message, fontName, fontSize);
frame.setConten tPane(panel);
frame.pack();
frame.setVisibl e(true);
}

public ShadowedTextFra me(String message,
String fontName,
int fontSize) {
messageImage = MessageImage.ma keMessageImage( message,
fontName,
fontSize);
int width = messageImage.ge tWidth(this);
int height = messageImage.ge tHeight(this);
setPreferredSiz e(new Dimension(width , height));
}

public void paintComponent( Graphics g) {
super.paintComp onent(g);
g.drawImage(mes sageImage, 0, 0, this);
}

}


Jul 17 '05 #1
0 1677

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
2906
by: Scotter | last post by:
Okay I think my title line was worded misleadingly. So here goes again. I've got quite 20 identical MDB files running on an IIS5 server. From time to time I need to go into various tables and add a field or two. It would be great if there were an application out there that could either: (a) sync all MDB designs (and/or data) designated to match one I've added some fields/tables to OR (b) go into all designated MDBs and create new...
1
1376
by: Darshan Arney | last post by:
I am just curious if others are annoyed with Microsoft's new subscription model? I recently upgraded my MSDN Universal expecting that would allow me to get the latest 2005 version when it comes out. Well, it does upgrade, but I have to choose an option: Team Architect, Team Developer or Team Test. Why doesn't Universal which by it's very name implies everything not include all of these variants? Why do we have all these variants? What...
9
2941
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with a device. The definition of the table is as follows: CREATE TABLE devicedata ( device_id int NOT NULL REFERENCES devices(id), -- id in the device
3
1642
by: Julia | last post by:
I need help with architecture design,please: I have a server which constantly downloading messages from the internet and store them inside a data base. the server have two administrators options: one is a local windows application,and the second is a web application The administrator can either delete messages,add new messages,and send messages
15
4649
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
5
1457
by: newjazzharmony | last post by:
I want to share one instance of an object across an ASP dot net application, and I'm trying to weigh the pros and cons of the following two approaches: a) Storing the object in ApplicationState b) Storing the object in a static member variable (utilizing a singleton design pattern) Any recommendations on which method would be more suitable? What happens in each of these cases if IIS decides to spawn a new app
8
2091
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a web form when one presses the button on the web form on a client pc, the sql query which is contained in the text box is sent to a vb net application on a server pc. The win application sends the query to the database, collects the results,
16
2544
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client uses IE to talk with a server. The user on the client (IE) sees an ASP net page containing a TextBox. He can write some text in this text box and push a submit button.
1
2332
by: karizmatrix22 | last post by:
Hi, I need a programmer who can write 3 programs for following questions below.Programs need to be ready before nextweek.thank you. Person who help me these 3 questions will be get paid.. I am new to programming, thats why i need help..i dont understand any coding at all. Question 1: Write an application that accepts a user’s password from the keyboard. When the entered password is less than six characters, more than ten characters, or...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10075
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.