| getResourceAsStream(file), j2me |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- bytecode decompilers (Re: what would be A way to go....)Osiris wrote:
> I don't want to give away my work. The idea is that people pay me for
> the number crunching service...
An enterprising soul can decompile your bytecode very easily. A number of
decompilers exist, such as this one: http://jode.sourceforge.net/ (see also
http://freshports.org/java/jode). The copyright will still protect you
legally, of course, but look at how much this protection is helping RIAA
and MPAA.
You may be able to compile Java source into machine code (for different OSes
and CPUs), but then it will not run inside browsers :(
I think, Sun and Amazon are offering application-hosting solutions, which
you may find affordable...
Or you may pay a regular hosting provider for a /dedicated/ server, where
you will be able to install/run anything you please (LAPACK, etc.) without
affecting their other customers. Some of those companies would even take
your own computer (which you'll configure and test beforehand).
It is still very tempting to take advantage of the user's own PCs. Can your
software be logically broken-up into the front- and back-ends? If it can,
and you don't mind the front-end code being decompiled, you may be able to
devise a hybrid approach...
-mi
- 3
- How to display the texts into 2 line in JButton?hi, I am newbies here.
I want to display 2 words in jbutton but if I use setText("Add Record");
When display, it show Add record (in a line)
I want it display as
Add
Record
(2lines)
in jbutton?
How to do that?
- 3
- Hentai Chicks Ravished Hard By Just few link on some movies...
All just for you...
Download
>>>>> http://sexy-teen.fateback.com
>>>>> http://celebrity-pornstar.bebto.com
>>>>> http://amateur-sex.yoll.net
CLICK FREE DOWNLOAD VIDEO PORN...
L
I
C
K
T
O
W
A
T
C
H
V
I
D
E
O
- 3
- can anybody please check this code out?Hi all,
I'm rather inexperienced in Java but I'm in need of defining a
JTable(N,N) with non-editable underdiagonal elements. I do not know if
it's better to do it by using TableModel or directly JTable, but I used
the latter because it looked easier to me.
The following code gives no errors in NetBeans, but using the newborne
UD_JTable class in MATLAB I get a very nasty error which pretty much
looks like some sort of memory allocation fault.
Here is the code:
import javax.swing.*;
import javax.swing.table.*;
public class UD_JTable extends JTable
{
public UD_JTable(int rows, int cols)
{
super();
}
public boolean isCellEditable( int rowIndex , int columnIndex)
{
if(rowIndex > columnIndex)
{
return false;
}
else
{
return true;
}
}
public static void main(String[] args)
{
}
}
And here is the error
??? Java exception occurred:
java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
at java.util.Vector.elementAt(Unknown Source)
at javax.swing.table.DefaultTableColumnModel.getColumn(Unknown Source)
at javax.swing.JTable.convertColumnIndexToModel(Unknown Source)
at javax.swing.JTable.setValueAt(Unknown Source)
.
Does anybody have a clue of what's happening???
Thank you ahead
lor
- 4
- Servlet: "action" failed to preload on startup in Web application: "xxxx".<Mar 15, 2005 10:10:38 PM EST> <Error> <HTTP> <BEA-101216> <Servlet:
"action" failed to preload on startup in Web application: "xxxx".
javax.servlet.ServletException: org/apache/log4j/Logger
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:909)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:873)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:812)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:3281)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3238)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3224)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3207)
at
weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5737)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:874)
at
weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2106)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2147)
at
weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2434)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2352)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2136)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
laveDeployer.java:2235)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
oyer.java:2130)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
laveDeployer.java:2315)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
veDeployer.java:866)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
oyer.java:594)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
loyer.java:508)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
dler.java:25)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
>
<Mar 15, 2005 10:26:13 PM EST> <Error> <HTTP> <BEA-101216> <Servlet:
"action" fa
iled to preload on startup in Web application: "WRAP".
javax.servlet.ServletException: org/apache/log4j/Logger
at
weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
pl.java:909)
at
weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
Impl.java:873)
at
weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
mpl.java:812)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
ervletContext.java:3281)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3238)
at
weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
ServletContext.java:3224)
at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
pServletContext.java:3207)
at
weblogic.servlet.internal.WebAppServletContext.setStarted(WebAppServl
etContext.java:5737)
at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:874)
at
weblogic.j2ee.J2EEApplicationContainer.start(J2EEApplicationContainer
.java:2106)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContai
ner.java:2147)
at
weblogic.management.deploy.slave.SlaveDeployer$ComponentActivateTask.
activateContainer(SlaveDeployer.java:2434)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.doCommit(
SlaveDeployer.java:2352)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.commit(SlaveDeplo
yer.java:2136)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.checkAutoCommit(S
laveDeployer.java:2235)
at
weblogic.management.deploy.slave.SlaveDeployer$Task.prepare(SlaveDepl
oyer.java:2130)
at
weblogic.management.deploy.slave.SlaveDeployer$ActivateTask.prepare(S
laveDeployer.java:2315)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(Sla
veDeployer.java:866)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareDelta(SlaveDepl
oyer.java:594)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDep
loyer.java:508)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHan
dler.java:25)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
>
======================================
Does anybody knows what to do?
upgrading app from WL7.0, struts 1.1 to WL8.1 SP3, struts 1.2.4
Did not updrade log4j-1.2.6.jar( which is working with WL7.0)
[log4j-1.2.9.jar gave too many compilation error when tried to upgrade
to with new env.]
Thanks
-Hemant
- 5
- problem while regenerating jpg file from swing image.Hi,
I am trying to regenerate the jpg file with the image that is
generated by java swings. But the x,y positions are not matching from
swing generated image to jpg file generated.Any body worked on the
similar problem please suggest.
Thanks in advance.
- 8
- Converting Java batch file from windows to unix formatMy java application includes source files in packages, and jar
library's in a lib directory.
I have created a windows batch file that compiles all and then runs the
application.
It is in the form of "javac classpath[jar files] [all package folders]
java classpath[jarfiles] [MainClass]"
The batch file is as so:
___________________________________________________________________
javac -classpath
"lib\jdom.jar;lib\ant.jar;lib\ant-launcher.jar;lib\liquidlnf.jar;lib\tools.jar"
antigen\builders\*.java antigen\config\*.java
antigen\datastructure\*.java antigen\gui\*.java antigen\io\*.java
antigen\listeners\*.java antigen\wizard\*.java
java -classpath
".;lib\jdom.jar;lib\ant.jar;lib\ant-launcher.jar;lib\liquidlnf.jar;lib\tools.jar"
antigen.config.Antigen
____________________________________________________________________
I have attempted to create a unix version of this (well i have tried to
make it work in mac os 10).
I have created a script that will run when i call "source BatchFile"
from the command prompt.
The script is as follows:
______________________________________________________________________
javac -classpath
/lib/jdom.jar:/lib/ant.jar:/lib/ant-launcher.jar:/lib/liquidlnf.jar:/lib/tools.jar
antigen/builders/*.java antigen/config/*.java
antigen/datastructure/*.java antigen/gui/*.java antigen/io/*.java
antigen/listeners/*.java antigen/wizard/*.java
java -classpath
".;/lib/jdom.jar;/lib/ant.jar;/lib/ant-launcher.jar;/lib/liquidlnf.jar;/lib/tools.jar"
antigen.config.Antigen
______________________________________________________________________
Java attempts to compile the source, but it doesnt include the jar
files in the classpath. Therefore i get a lot of library specific
errors.
Does anyone know why? Does unix work with the classpath differently?
Can someone help me create a batch file for a unix system.
Thanks
PS I do not want to use a build tool, as the whole point of the
application is to allow use of ant without installing it.
- 9
- Java Program error need helpI am working on this program for class and I can't figure out why I am
getting class or interface expected on the last two { symbols. Please
help, I am not trying to cheat, just need a point in the write
direction. Thank you
/*
Author: Kevin Rosier
Course: POS 407
Assignment: Week 3 Mortgage Calculator
Written: Oct 16, 2006
Creates a sales tax calculator with a GUI.
*/
// class names
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.text.*;
import java.util.*;
import javax.*;
public class MortgageCalculatorGUIwk3 extends JFrame implements
ActionListener
{
JFrame mortgageFrame;
JPanel mortgagePanel;
JButton mortgageButton;
JButton clearButton;
JButton exitButton;
JLabel mortgageLabel;
JLabel interestrateLabel;
JLabel yearLabel;
JLabel paymentLabel;
JTextField mortgageField;
JTextField interestrateField;
JTextField yearField;
JTextField paymentField;
public MortgageCalculatorGUIwk3() //constructor
{
{
// defining JFrame
mortgageFrame = new JFrame("Calculate Your Mortgage Payment");
mortgageFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mortgageFrame.setSize(500,500);
//public static void main(String args[]){
ActionListener actionListener = new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
AstractionButton aButton = (AbstractButton)
actionEvent.getSource();
boolean selected = abutton.getmodel().isSelected();
System.out.println(actionEvent.getActionCommand()
+ " - selected? " + selected);
}
};
//constructs Radio buttons
JMenuBar menuBar = new JMenuBar();
JMenu menu = new JMenu("Menu");
ButtonGroup buttonGroup = new ButtonGroup();
menu.setMnemonic(KeyEvent.VK_M);
JRaidoButtonMenuItem emptyMenuItem = new
JRadioButtonMenuItem();
empyMenuItem.setActionCommand("Empty");
emptyMenuItem.addActionListener(actionListener);
buttonGroup.add(emptyMenuItem);
menu.add(empyMenuItem);
JRadioButtonMenuItem oneMenuItem = new JRadioButtonMenuItem("7
years at 5.35%");
oneMenuItem.addActionListener(actionListener);
buttonGroup.add(oneMenuItem);
menu.add(oneMenuItem);
JRadioButtonMenuItem twoMenuItem = new JRadioButtonMenuItem("15
years at 5.5%");
twoMenuItem.addActionListener(actionListener);
buttonGroup.add(twoMenuItem);
menu.add(twoMenuItem);
JRadioButtonMenuItem threeMenuItem = new
JRadioButtonMenuItem("30 years 5.75%");
threeMenuItem.addActionListener(actionListener);
buttonGroup.add(threeMenuItem);
menu.add(threeMenuItem);
menuBar.add(menu);
frame.setJMenuBar(menuBar);
frame.setSize(350, 250);
frame.setVisible(true);
// defining JPanel
JPanel mortgagePanel = new JPanel(new GridLayout(7,2,10,30));
// defining contents on the panel
mortgageLabel = new JLabel("Mortgage Amount Desired");
interestrateLabel = new JLabel("Interest Rate Desired");
yearLabel = new JLabel("Years of Mortgage");
paymentLabel = new JLabel("Payment");
mortgageButton = new JButton("Your Monthly Payment Is");
clearButton = new JButton("Reset");
exitButton = new JButton("Exit");
// data for calculations
mortgageField = new JTextField("");
interestrateField = new JTextField("");
yearField = new JTextField("");
paymentField = new JTextField("");
paymentField.setEditable(false);
// Adding components to the GUI
mortgagePanel.add(mortgageLabel);
mortgagePanel.add(mortgageField);
mortgagePanel.add(interestrateLabel);
mortgagePanel.add(interestrateField);
mortgagePanel.add(yearLabel);
mortgagePanel.add(yearField);
mortgagePanel.add(mortgageButton);
mortgagePanel.add(clearButton);
mortgagePanel.add(exitButton);
mortgagePanel.add(paymentLabel);
mortgagePanel.add(paymentField);
mortgageFrame.add(mortgagePanel);
mortgageFrame.setVisible(true);
// action buttons
mortgageButton.addActionListener(this);
clearButton.addActionListener(this);
exitButton.addActionListener(this);
}
} //end constructor
// What action is to be performed
public void actionPerformed(ActionEvent e)
{
Object source = e.getSource();
if(source == mortgageButton) {
String sMortgage = mortgageField.getText();
String sInterestrate = interestrateField.getText();
String sYear = yearField.getText();
double mortgage = Double.parseDouble(sMortgage);
double interestrate = Double.parseDouble(sInterestrate);
double year = Double.parseDouble(sYear);
double numberOfPayments = year * 12;
double monthlyInterest = interestrate / 100 / 12;
double x = Math.pow(1+monthlyInterest, numberOfPayments);
double monthlyPayment = (mortgage * x * monthlyInterest)/(x-1);
DecimalFormat df = new DecimalFormat("$0,000.00");
paymentField.setText(df.format(monthlyPayment));
}
else if(source == clearButton)
{
mortgageField.setText("");
interestrateField.setText("");
yearField.setText("");
}
else if(source == exitButton)
{
System.exit(0);
}
} // end actionPerformed
public static void main(String [] args) {
MortgageCalculatorGUIwk3 thisCalc = new MortgageCalculatorGUIwk3();
}; //end main
};
} //end class
}
- 9
- CLASSPATH, javac -classpath and java -cp?I'm trying to figure something out and I need some gurus help (I'm using if
it's of any use?).
I compile a very simple class (test.java) that does nothing but
System.err.println( "testing"); in a public class with an empty constructor.
I can compile it and everything is good. When I goto run it, I get the
famous java.lang.NoClassDefFoundError: test. I have the j2sdk142/lib and
the j2sdkee1.3.1/lib in the CLASSPATH statement when I get this error. But
if I take out the CLASSPATH (set CLASSPATH=), it runs just fine. What's up?
Why is that? I thought the classpath stuff would help here?
Why does the javac command have the longer -classpath parmameter while the
java has the shorter -cp parmater when they seem to do the samething? And
why don't those two commands (javac and java) appear to be using the
CLASSPATH environment variable?
I know, lots of questions, but I'm trying to figure this out. Thanks for any
help you can offer.
- 9
- 9
- Unusual Error Message
I have some Java classes that accept parameters, perform login then
update MYSQL tables. The code runs fine when executed from IDE
(JBuilder). When I try to run it from a JSP I get the following
message. Can't make heads or tails out of it. Does anyone see the
problem? What does the first line mean?
Thanks
javax.servlet.ServletException: Name index 59136 in LocalVariableTable
has bad constant type in class file
com_xyz_practice/CrunchBracketSchedule
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp._jspService(org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp:118)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.ClassFormatError: Name index 59136 in LocalVariableTable has
bad constant type in class file com_xyz_practice/CrunchBracketSchedule
java.lang.ClassLoader.defineClass1(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:620)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1629)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:850)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1299)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
com_xyz_practice.ScheduleBrackets.Schedule(ScheduleBrackets.java:59)
org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp._jspService(org.apache.jsp.brackets20B.bracket_005fauto_005fsch_005fbrks_jsp:92)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
- 13
- JSTL - Following MVCHi, I've got a J2EE application (trying) to follow the MVC paradigm.
So far, there is a data model, which is sent to the view. The view
then calls java functions to html formate Strings from this model,
using inline java code, which I don't like very much. Would you:
a) leave it as it is
for: No work to do
against:Mixes JSTL tags with java inline code - ugly
b) add an additional "view-model" attribute for each attribute to be
displayed on the view, that already contains the necessary html style
informations
for: No more logic (java inline code) in the jsps
against: each attribute exists in 2 varieties in one hugh model
c) Add another view-model, and map from data-model to view model in a
huge loop before displaying the view model on the view?
pro: Data-model and view-model are totally separated, no more logic in
the jsps
against: lots of programming to do, and mapping all attributes from
one model to the other model would cost a lot of performance.
d) Simply add new getter methods for each attribute to the current
data-model.
So e.g. there would be a getName() method to get the data
representation of the name, and getFormatedName() which would first
call getName and then manipulate the name attribute to get a view
representation of it.
pro No more logic in the jsps, beans will not be "flooded" by
"duplicate attributes"
contra: Data model would still contain view-model getter methods.
Thanks for your advice,
Christine
- 14
- [OT] Linux Flaw DiscoveredKernel Flaw Makes Linux Crash Easily
A flaw in the Linux kernel allows a 20-line C program to crash most
distributions of the operating system using the 2.4 and 2.6 kernels
running on x86 and x86-64 architectures, according to security
researchers.
http://www.computerworld.com/newsletter/0,4902,93833,00.html?nlid=OS
l8r, Mike N. Christoff
- 14
- Setter method in form bean corresponding to text field in JSPhi all,
In my JSP, I am having a text field like this
<input type="text" name="data(id)" />
Please note, that I am not using <html:text> tag. Can you tell me what
should be the corresponding setter nethod signature in the bean.
I have tried
public void setData(String key, String value) and
public void setData(String key, Object value)
but both of them are not working.
I have also noted that if I use <html:text> tag in the same mannar,
then my {Object value} setter method gets called.
Thanks for any help,
- 15
- Cannot send an MP3 file as email attachment...I want to send an email with an MP3 file as attachment. If I do not
set content type, the file received will not be in the correct format.
But when I set content type to audio/mp3, I will receive
unsupporteddatatype exception. How can I send an mp3 file as an
attachment so that when I download the mp3 file from the email, the mp3
file will work and play as usual?
Someone said I may modify the activation.jar by editing the mailcap
file. However, I don't know what to add to the file. The file only
contains:
#
# This is a very simple 'mailcap' file
#
image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer
image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer
text/*;; x-java-view=com.sun.activation.viewers.TextViewer
text/*;; x-java-edit=com.sun.activation.viewers.TextEditor
My program is below:
=======================
package my;
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
//import java.lang.Object.*;
//import javax.activation.CommandMap.*;
//import javax.activation.MailcapCommandMap.*;
public class rSendMail{
private String to;
private String from;
private String smtpServer="smtp.macau.ctm.net";
private String subject;
private String body;
private String contenttype;
private String attachfile;
public void setTo(String sTo)
{
to=sTo;
}
public void setFrom(String sFrom)
{
from=sFrom;
}
public void setSmtpServer(String sSmtpServer)
{
smtpServer=sSmtpServer;
}
public void setSubject(String sSubject)
{
subject=sSubject;
}
public void setBody(String sBody)
{
body=sBody;
}
public void setContentType(String sContenttype)
{
contenttype=sContenttype;
}
public void setAttachment(String sAttachment)
{
attachfile=sAttachment;
}
public void send(String path)
{
try
{
//MailcapCommandMap mc =
(MailcapCommandMap)CommandMap.getDefaultCommandMap();
//mc.addMailcap("text/html;;
x-java-content-handler=com.sun.mail.handlers.text_html");
//mc.addMailcap("text/xml;;
x-java-content-handler=com.sun.mail.handlers.text_xml");
//mc.addMailcap("text/plain;;
x-java-content-handler=com.sun.mail.handlers.text_plain");
//mc.addMailcap("multipart/*;;
x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
//mc.addMailcap("message/rfc822;;
x-java-content-handler=com.sun.mail.handlers.message_rfc822");
//CommandMap.setDefaultCommandMap(mc);
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
msg.setSubject(subject);
msg.setText(body);
// StringBuffer sb = new StringBuffer();
// sb.append("<a href='"+path+"'>HERE</a>");
// msg.setText(body+sb.toString());
// msg.setContent(attachfile,contenttype);
// msg.setFileName(attachfile);
// -- Set some other header information --
msg.setHeader("X-Mailer", "LOTONtechEmail");
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
// System.out.println("Message sent OK.");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
|
| Author |
Message |
Rafal Suchowirski

|
Posted: 2005-2-21 4:07:00 |
Top |
java-programmer, getResourceAsStream(file), j2me
hi
i'm writing a program for mobile phone, and i use
getResourceAsStream(String)
when i use:
readFile("/data/file/1");
i can read file, but when i use
readFile("/data/file/"+randomINT);
i get error
java.lang.NullPointerException
but the file exist...:(
it's my code
public final Enumeration readFile(String s) {
Vector v = new Vector();
try {
InputStream in = this.getClass().getResourceAsStream("/res/"+s);
StringBuffer data = new StringBuffer();
/*.....
.....*/
} catch (Exception _e) { _e.printStackTrace();}
return v.elements();
}
What could be wrong?
|
| |
|
| |
 |
Darryl Pierce

|
Posted: 2005-2-21 8:35:00 |
Top |
java-programmer >> getResourceAsStream(file), j2me
Rafal Suchowirski wrote:
> i'm writing a program for mobile phone, and i use
> getResourceAsStream(String)
> when i use:
> readFile("/data/file/1");
> i can read file, but when i use
> readFile("/data/file/"+randomINT);
> i get error
> java.lang.NullPointerException
> but the file exist...:(
What is the value of "randomINT" at the above point where it's used?
> it's my code
>
> public final Enumeration readFile(String s) {
> Vector v = new Vector();
> try {
> InputStream in = this.getClass().getResourceAsStream("/res/"+s);
Does your jar actually have a directory called "/res" and does it
contain a file whose name matches the value of "s" i the above code
snippet?
> What could be wrong?
Any of a number of things:
o the directory /res isn't in the JAR file
o the directory's there but doesn't contain a file whose name matches
the value of s
o the value of s is empty or null
--
Darryl L. Pierce <email***@***.com>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
|
| |
|
| |
 |
Rafal Suchowirski

|
Posted: 2005-2-21 14:34:00 |
Top |
java-programmer >> getResourceAsStream(file), j2me
Darryl Pierce napisa?a):
>> i'm writing a program for mobile phone, and i use
>> getResourceAsStream(String)
>> when i use:
>> readFile("/data/file/1");
now i use readFile("1");
>> i can read file, but when i use
>> readFile("/data/file/"+randomINT);
and readFile(randomINT);
where randomINT is a random numer from 1 to 20
>> i get error
>> java.lang.NullPointerException
>> but the file exist...:(
>
>> it's my code
>>
>> public final Enumeration readFile(String s) {
>> Vector v = new Vector();
>> try {
>> InputStream in = this.getClass().getResourceAsStream("/res/"+s);
>
>
> Does your jar actually have a directory called "/res" and does it
> contain a file whose name matches the value of "s" i the above code
> snippet?
>
yes, it has directory called /res and contain files
/res/1
...
/res/20
>> What could be wrong?
>
> Any of a number of things:
>
> o the directory /res isn't in the JAR file
> o the directory's there but doesn't contain a file whose name matches
> the value of s
> o the value of s is empty or null
JAR file has /res directory and contain files
and i can open file from /res
when i use String that it's known before compiling midlet
but when i use randomINT (when value isn't known before compiling)
it fails
System.out.println(""+s);
print value of s and it's in /res directory
|
| |
|
| |
 |
Darryl Pierce

|
Posted: 2005-2-21 21:13:00 |
Top |
java-programmer >> getResourceAsStream(file), j2me
Rafal Suchowirski wrote:
> Darryl Pierce napisa?a):
>
>>> i'm writing a program for mobile phone, and i use
>>> getResourceAsStream(String)
>>> when i use:
>>> readFile("/data/file/1");
<snip>
> JAR file has /res directory and contain files
> and i can open file from /res
> when i use String that it's known before compiling midlet
Your readFile method in the above example is using "/data/file" and not
"/res". Is that your problem?
--
Darryl L. Pierce <email***@***.com>
Visit my homepage: http://mcpierce.multiply.com
"By doubting we come to inquiry, through inquiry truth." - Peter Abelard
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- FreeBSD 4.10-p3 - java/eclipse - Errors when building WITH_MOTIFWhile building java/eclipse port error occurs ...
$ make build -DBATCH -DWITHOUT_GNOMEVFS -DWITH_MOTIF
#
"Makefile", line 75: Malformed conditional (empty(${BUILD_KDE}))
"Makefile", line 75: Missing dependency operator
"Makefile", line 80: if-less endif
"Makefile", line 80: Need an operator
make: fatal errors encountered -- cannot continue
... done build in /misc/ports/java/eclipse
...but the minimum command to make above errors happen seem to be
(for that matter, change BUILD_KDE to any other variable) ...
make -V BUILD_KDE -DWITH_MOTIF
Some versions...
FreeBSD (running) 4.10-RELEASE-p3
Eclipse (trying to install) 1.23 2004/07/28 17:56:31 (from $FreeBSD ...$)
GCC (port installed) 3.4.2_20040827
How can i resolve the errors (on FreeBSD 4.x)?
- Parv
--
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 2
- $100 Free @ Lucky777.orgLucky777 Casino - All the best casino games and slots playable online for free or real money in 16 international languages.
(French, German, Spanish, Traditional Chinese, Simplified Chinese, Dutch, Swedish, Italian, English, Korean, Portuguese, Japanese, Arabic, Hebrew, Danish, Greek).
Free $100 signup bonus for all new players
http://Lucky777.org
- 3
- java/119654: jdk 1.6: java.awt.SplashScreen#getSplashScreenMartin Keller wrote:
> java.lang.UnsatisfiedLinkError: /usr/local/jdk1.6.0/jre/lib/i386/libsplashscreen.so: /usr/local/jdk1.6.0/jre/lib/i386/libsplashscreen.so: Undefined symbol "jpeg_resync_to_restart"
> at java.lang.ClassLoader$NativeLibrary.load(Native Method)
> at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
> at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
> at java.lang.Runtime.loadLibrary0(Runtime.java:823)
> at java.lang.System.loadLibrary(System.java:1030)
> at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.awt.SplashScreen.getSplashScreen(SplashScreen.java:91)
> at de.uplanet.setup.MainFrame.<init>(Unknown Source)
> at de.uplanet.setup.SetupController.go(Unknown Source)
> at de.uplanet.lucy.setup.ServerSetup.main(Unknown Source)
On my 7.0-PRERELEASE amd64 box this symbol is defined by the JPEG library:
% nm /usr/local/lib/libjpeg.so.9 | grep resync
000000000000fb25 T jpeg_resync_to_restart
Does adding java.library.path=/usr/local/lib (e.g. java
-Djava.library.path ...) help?
Does reinstalling your JPEG library help?
Can you provide some code to repeat this error?
--Marcin
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 4
- Going, nuts 2 printwriters?Can you call 2 printwriters in a function(main) because on the first
call of printwriter, everything is fine, on the second call I get a
compile error, java.io not found.
// no error
// get a handle to the output stream
PrintWriter out = new PrintWriter(System.out);
String _sWidth = "480";
String _sHeight = "365";
String _fname = e__mainHTML + "i_" + sewershed + _PipeID + ".html";
Writer _tmp = java.io.FileWriter(_fname);
PrintWriter newout = PrintWriter(_tmp);
I get an error above.
- 5
- I wanna do some postprocessing of class file, please help menow, I wanna do some post-processing of class file, actually, I need
to add some code to the existed class file. my idea is to use djava to
form the byte-code in jasmin version, then I modify the jasmin code to
create new class. but It has many errors after using jasmin to create
new code even though I didn't add any code in jasmin.
so did someone do the same job before?
thanks!
- 6
- How can you guy sit so much as programmer?Sometimes, I am concern about the long term effect of sitting all day
long. I used to be on my feet all day long (in the lab) before.I
started studying CIS.
I was okay with sitting long hours when doing programming project for
my courses in school - though I developed shoulder balde pain from my
computer set up at home and had to get massage treatment - but these
days, I am more conscious about the effect on health in sitting long
hours. I don't think our species is made to sit like this. In the long
run, say 10 years from now, I wonder how all these sitting non-stop
would affect us.
What do you people do to compenstate for all those sitting all day
long? Any special stretching exercise?
BTW, I have made my own foot rest - someone from Myofacial groupd
helped me in guiding with the design - and something to put the mouse
by placing it over the number keypad area of the keyboard (on the
keyboard try) so that the mouse would be the exact height I needed,
aligning with the arm resting bar of the chair. Since then no more
shoulder blade pain nor sharp neck pain.
- 7
- How to build a help file?Hello All,
I am writting a Java GUI application. I want to build a help file for users.
I want to add a help menu in the menubar so when user click on it, a popup
window will show the instructions. What should the popup window be? A
JOptionPane, a new Frame or what else? Can anyone give me a clue?
Thanks in advance.
- 8
- GeoTools 2.0 problem with LINE_CAP_ROUNDHi,
I want set geometry property in StyleBuilder.createLineSymbolizer() method
with this java code:
StyleBuilder builder = new StyleBuilder();
LineSymbolizer ls1 = builder.createLineSymbolizer(Color.BLACK, 10,
StyleBuilder.LINE_CAP_ROUND);
Style style= builder.createStyle();
style.addFeatureTypeStyle(builder.createFeatureTypeStyle(null,
builder.createRule(ls1)));
bat this not work.
You can help me?
Carlo
- 9
- Migrate a Tomcat app to JBossHello all,
This is a general question and I am not familiar with the Tomcat running
under JBoss but let me ask it. I am running JBoss 4.0.2 off port 8080
and I have Tomcat running my website off of port 80 at
weconsultants.servebeer.com
I want to migrate my website from my Tomcat 5.5.9 version to JBoss's
embedded Tomcat server. I have no clue how to do this. I can't seem to
find the instruction on how to go about this process. When I look at the
JBoss directory structure it looks alien to me and looks nothing like
Tomcat's directory layout.
Any help or direction would be appreciated..
--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
__________________________________________________________________________
' If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
- 10
- Webserver & TomcatHi Everyone,
I want to learn to make JSP Pages, I've heard I need Tomcat for this. Is this
a webserver or do I also need to install Apache?
Thanks!
- 11
- Version 1.1 of Allatori Java Obfuscator is released.Allatori Java Obfuscator belongs to the second generation obfuscators'
family and has all spectrum of opportunities on protection of your
intellectual property. In the Allatori arsenal there are the following
protection methods: name obfuscation, flow obfuscation, debug info
obfuscation, string encryption, watermarking.
In the new version we have fixed some issues with Java 1.5 support,
introduced stronger and faster string encryption, optimized control flow
analysis, fixed and improved the renamer algorithm.
Allatori Java Obfuscator web site: http://www.allatori.com
Demo version download:
http://www.allatori.com/downloads/Allatori-1.1-Demo.zip
- 12
- mjpegHi
Must you have jmf on the client machine to play a mjpeg file in a applet?
Paolo
- 13
- Right newgroup?If this is not the correct newgroup for this could you point me in the
correct direction, otherwise....here is the question.
Jave uses a JVM. Why can't compilers be build for Java at least on the
popular CPU's?
TIA
- 14
- Stylesheets and Schema validation in Apache AXIS 1.xIt is often written that in document literal style - one has a lot of
flexibility and one can do these two things specifically:
1. Validate the SOAP body against a schema
2. Use an XSLT stylesheet to modify the SOAP body XML. ( I have two
versions of services and for one of them - I need to slightly modify
the message body)
I have a document literal WSDL and I generated classes using WSDL2Java.
Everything works as expected but I can't do either of the above two
things - XSLT or schema validation since the XML gets converted to
objects before I can do anything with it. Any suggestions?
Thanks!
- 15
- a question for sorting keys in MapHi,
I have a Map, actually a TreeMap, which will automatically sort the keys
alphabetically. The keys are Strings, like "VARIABLE" + i, e.g:
VARIABLE0, VARIABLE1, VARIABLE2, etc.
If the total number of entries < 10, then the sorted order is ok:
VARIABLE0
VARIABLE1
VARIABLE2
But, if the total number of entries > 10, the sorted order is not what I
want:
VARIABLE0
VARIABLE1
VARIABLE10
VARIABLE11
VARIABLE12
..
VARIABLE2
VARIABLE20
VARIABLE21
..
VARIABLE3
VARIABLE30
VARIABLE31
..
I want the order be:
VARIABLE0
VARIABLE1
VARIABLE2
..
VARIABLE9
VARIABLE10
VARIABLE11
...
Can you help me to achieve this? Thank you very much.
|
|
|