| Where can I get java virtual machine of IBM ? |
|
 |
Index ‹ java-programmer
|
- Previous
- 2
- Call for contributions: SACMAT '049th ACM SYMPOSIUM ON ACCESS CONTROL MODELS AND TECHNOLOGIES (SACMAT
'04)
Symposium web page: www.sacmat.org
Dates: June 2-4, 2004
Place: IBM Thomas J Watson Research Center, Yorktown Heights, NY, USA
Collocated with Policy Workshop (June 7-9, 2004)
PURPOSE
The missions of the symposium are to share novel access control
solutions that fulfill the needs of heterogeneous applications and
environments and to identify new directions for future research and
development. SACMAT gives researchers and practitioners a unique
opportunity to share their perspectives with others interested in the
various aspects of access control.
SCOPE
* Access control requirements
* Access control within the context of emerging standards
* Access control models and extensions
* Access control for innovative applications
* Methodologies and tools for access control policy design
* Administration of access policies
* Authorization management
* Access control mechanisms, systems and tools
* Access control in distributed and mobile systems
* Safety analysis and enforcement
* Theoretical foundations for access control models
NEW
Industry reports are a unique opportunity for the practitioners to
provide feedback on the state of the practice in access control
models, architectures, technologies, and systems to the research
community. SACMAT steering committee invites practicing researchers,
security consultants, security officers and architects, security
managers, and end user representative to share their experience on
implementing and using access control solutions in real world with the
researchers in the field.
IMPORTANT DEADLINES
Papers and Panels
Submissions due December 15, 2003
Notification of acceptance February 23, 2004
Final versions dues March 23, 2003
Industry Reports
Submissions due February 2, 2004
Notification of acceptance March 1, 2004
Final versions dues March 23, 2003
Konstantin Beznosov
SACMAT '04 Publicity Chair
- 3
- loading a resource from a jar fileHi All,
When I generate the jar file from the command line, loading a resource
e.g. text file or gif works fine but when I "export" the jar file from
within eclipse (or using ant), the loading does not work. What is the
difference? And how can I fix this problem?
Thanks in advance,
Ahmed
- 3
- modifying java.lang.String.javaHi,
I'm trying to modify java.lang.String.java and add the modified
String.class to
rt.jar [THIS IS FOR MYSELF ONLY AND WILL NOT BE DEPLOYED].
I cannot add "private final boolean tainted[] = new
boolean[5];" to String.java. If I do, it still compiles and I can add
it to rt.jar and compile a test program against it. However, the JVM
crashes with a strange message:
java.lang.IllegalArgumentException: name can't be empty
at java.security.BasicPermission.init(Unknown Source)
at java.security.BasicPermission.<init>(Unknown Source)
at java.lang.RuntimePermission.<init>(Unknown Source)
at java.lang.Thread.<clinit>(Unknown Source)
I tried various ways of rewriting the above such as adding "private
final boolean tainted[];" and initializing it in each constructor.
Nothing works.
I can add methods to String.java and even the member variable "private
boolean isTainted;" and it works just fine. Do you have any ideas for
why adding a boolean array does not work (or better yet how to get
around this issue)?
Thank you,
Daniel
- 5
- Understanding some Java basicsHi experts,
I'm a bit familiar to Java and i want to begin programming under Java
with a good beginner's resource but there are some confusions in my
mind:
1-I know Java applications cannot be run as an executable file, there
must be a interpreter needed, what's the most convenient way to run
and show my projects under computer enviroment? Applet-like class
files inside browsers or mobile emulators? Or JAR archives?
2-I want to learn basics for developing applications for mobile
phones(like modern Nokia phones) and i learnt that there are some
concepts like MIDP, MIDLETs, J2ME (micro edition) and like that. What
concept is the complete and the most convenient standard for beginning
development for mobile phones?
3-.Which IDE is the most easy-to-understand? I heard about Netbeans
with no experience, also i'm familiar to Microsoft's Visual Studio
but don't know if there's VS-like IDEs for Java which also supports
development for mobile area.
4-I have the latest Java run-time installed(Java Standard Edition from
www.java.com), then i need to download Java Development Kit (JDK) to
start programming under JAVA. Right?
As Final:
5- I heard inspirations for Java about being similiar to C++ and low-
level languages. So, how good is to transfer and manipulate C++
syntaxes into Java programming enviroment?
I needed to consult to your big experiences to have a good start with
Java :-) If you help me to understand and recommend the goods, i'd
appreciate.
Regards...
- 5
- J2ME - Newbie questionHi NG,
after I've googled now for several hours, I'm more confused then
before. And I thought, what I want to do is a simple every-day
problem.
I want to write an application, that communicates with a palm device,
in this case the m500. Therefore, I neet the following features:
* write/create files from within the palm device to the memory of the
palm
* read this files from within my desktop application.
Most important in my case would be files in xml format. I think this
is a problem many programmers must find when they want to develop
applications that use a palm device. But it seems that there is
nowhere a useful example. If anybody has developped similar things, or
can give me any hint or url, would be a great help.
What I did already: I installed the WTK2.0, build some examples, tried
to install the PDADemo example on my palm and execute it. I get the
error:
can't load javax.microedition.io.file.FileConnector
I think that would be exactly the thing I would need, but it seems not
to work.
Thanks very much in advance for every kind of help,
Bene
- 7
- fail to build ports/java/jdk14 on 5-currentOn Wed, 25 Jun 2003, Ying-Chieh Liao wrote:
> I've installed ports/java/linux-sun-jdk14, and I want to install jdk14
> but it fails :<
On my
5.1-CURRENT FreeBSD 5.1-CURRENT #0: Sat Jun 21 11:48:56 CEST 2003
jdk14 installed yesterday. Perhaps you need an upgrade?
Regards,
Uli.
>
> Is this a known problem, or am I missing something ?
> here's my error message
>
> ===> Applying FreeBSD patches for jdk-nodebug-1.4.1p3_3
> ===> jdk-nodebug-1.4.1p3_3 depends on executable: gm4 - found
> ===> jdk-nodebug-1.4.1p3_3 depends on executable: zip - found
> ===> jdk-nodebug-1.4.1p3_3 depends on file: /usr/X11R6/lib/libXm.so - found
> ===> jdk-nodebug-1.4.1p3_3 depends on file:
> /usr/local/linux-sun-jdk1.4.1/bin/javac - found
> ===> jdk-nodebug-1.4.1p3_3 depends on executable: gmake - found
> ===> Configuring for jdk-nodebug-1.4.1p3_3
> ===> Building for jdk-nodebug-1.4.1p3_3
> # Start of jdk build
> bsd i586 1.4.1-p3 build started: 03-06-25 15:54
> Syntax error: "(" unexpected
> gmake[1]: Entering directory `/usr/ports/java/jdk14/work/j2se/make'
> [: -ne: unexpected operator
> gmake[1]: *** No rule to make target `6_2003_15_54'. Stop.
> gmake[1]: Leaving directory `/usr/ports/java/jdk14/work/j2se/make'
> gmake: *** [j2se-sanity] Error 2
> *** Error code 2
>
> Stop in /usr/ports/java/jdk14.
>
> --
> Pi seconds is a nanocentury.
> --- Tom Duff
>
+-----------------------------------+
| Peter Ulrich Kruppa |
| - Wuppertal - |
| Germany |
+-----------------------------------+
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 7
- Displaying oracle table in jsp as a html tableDear All,
Is there any custom tag, procedure, any mechanism which will let me
put the html code to display the table rows from Oracle database table
into a JSP page?
Any procedure which accepts some parameters like table name, database
connection url, database username, password etc. and display the table
data in a web page?
-Sameer
- 8
- HTTP creep
"dar7yl" <email***@***.com> wrote in message news:ccfKc.58783$Rf.534@edtnps84...
> You are assuming that most traffic is large .jpg's, mpg's, etc.
> But if you look at the typical usage, a web page consists mainly of a bit
of
> text, maybe a few "medium sized" pictures, and a lot of fussy little .gif
> icons.
> The http header is sometimes 2-5X the size of the actual data.
> That's important if you are constrained to a small channel, for instance a
> bluetooth enabled cell phone.
> And overall, it adds up: "If you take care of the pennies, the dollars
will
> look after themselves"
Not at all true. This is the largest difference between the professional
software engineer and the amateur programmer. The amateur tries to optimize
everything. The professional measures first, and optimizes only where it's
worthwhile, and measures again to ensure that the "optimization" actually
helps. When I hear a suggestion to change one of the most widely used
protocols in the world, and consider how many person-hours the
standardization process would consume, the amount of HTTP-processing code
that would have to change, the opportunity for introducing bugs into
currently correct HTTP implementations, the indefinitely prolonged need for
backward compatibility, the expense involved in negotiating the version of
HTTP used in any given conversation, etc, and I don't see even an estimate
of how much useful bandwidth would actually be saved, much less an actual
measurement, it's clearly amateur hour.
- 8
- Web service : JAX-RPC handler and loggingHello,
I want to log every call to my web services (the logging message must
group the SOAP message and some additional context information). I
will log the request and the response.
Log messaging must be assured by a MQ infrastructure.
I was going to implement the logging with a JAX-RPC handler using JMS.
But the J2EE for Web services spec indicate that :
Handlers run under the transaction context of the component they are
associated to.
So, if I associate my handler with an EJB Session stateless and this
latter one calls setRollbackOnly, my logging actions will also be
rolled back.
Is there a good solution ?
Thanks for your help
- 9
- jarHello all, I am trying to create an executable jar file from my JOGL prog.
When trying to run it (example.jar)so: java -jar example.jar I get error:
can't find class ..net/java/jogl/GLEventListener. Any suggestions or
comments gratefully received.
Ivan
- 11
- 11
- java.net.ConnectException: Connection refusedHi,
i have something very strange here:
when i try to connect from my Client (written in Java) my Server (also
in Java) i get SOMETIMES
java.net.ConnectException: Connection refused
1. under Gentoo Linux and localhost:4444 NO EXCEPTION
2. under Knoppix + Debian Linux localhost:4444 NO EXCEPTION
3. windows 2000 localhost:4444 EXCEPTION!
4. all the tree systems IP.of.an.other.PC:4444 EXCEPTION!
Does anybody know why?
Another Client/Server Application (BabylonChat) runs well in any
Configuration!!
Have a nice Day.
Karaca
- 11
- Calypso Medical - Senior Software Engineer - ConnectivityAt Calypso?Medical, innovation is our passion. We have created the
first in a series of innovative products destined to advance the
science of radiation therapy treatment for cancer specialists and
their patients. And that's just the beginning.
We value individual initiative, originality and intellectual
curiosity. Small teams excel in achieving milestones and delivering
results. Our team thrives on open communication, resourcefulness and
rapid problem solving.
At Calypso?Medical, located in downtown Seattle, Washington, we are
proud of our technical excellence, but most importantly, we are
committed to making a difference in radiation therapy.
Calypso?Medical is currently recruiting for several positions on our
software product development team. Our company recently closed on
$42M in a private equity financing to support the market launch of
our FDA approved Calypso?4D Localization System and is seeking
additional talent to further our new product development efforts.
Come join a company on the move!
Senior Software Engineer, Connectivity
Calypso?Medical is looking for a Sr. Software Engineer, Connectivity
to create software for use in patient treatment and reporting
applications. This position will design and develop software for
networked medical devices. Responsibilities include, but are not
limited to the design, development, test and documentation of
software for data transformation, data management and connectivity
solutions; the design of databases, database interface, and
connectivity solutions for servers and clients; active assistance in
resolving integration issues; and architectural and code reviews.
This position may require 10% travel.
Minimum requirements include 7+ years experience developing
distributed multi-threaded, multi-process, and multi-tiered
applications; significant experience with the entire product life-
cycle as well as with developing prototype applications; demonstrable
proficiency with Window development platforms (multiple operating
systems experience preferred); significant experience in developing
applications with two of the following three languages: (C#, C++,
and/or Java); B.S. in C.S. or engineering discipline; experience
interfacing applications with relational databases (RDBMS);
familiarity with ADO.NET and SQL server; strong Microsoft Transact-
SQL language, stored procedures, database designs, triggers,
connectivity, and security; experience with COM, Win32 and .NET
interoperability; preferred experience developing .NET applications,
JBOSS, J2EE, XML, SOAP, web services, DICOM applications; experience
with HL7, developing medical applications or devices desired.
Email: email***@***.com
Calypso?Medical Technologies, Inc. is an Equal Opportunity Employer
- 13
- tungsten screen sizeHi! This is my first program written for the Tungsten E, which has a
320x320 screen. It prints out 160x144, which is a quarter of actual
with extra space around, and the lines drawn are two pixels wide. Is
there a way to get it to fix this?
package hello;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Hello extends MIDlet {
private Canvas canvas;
public Hello() {
canvas = new Canvas() {
public void paint(Graphics g) {
g.setColor(0);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0xffffff);
g.drawString("Pfui! "+getWidth()+"x"+getHeight(), //print size
0,0,Graphics.TOP|Graphics.LEFT);
for(int i = 10; i < getHeight(); i += 10)
g.drawLine(0,i,getWidth(),i); //draw lines
}
public void pointerPressed(int x,int y) {
Hello.this.notifyDestroyed(); //exit
program
}
public void keyPressed(int keyCode) {
Hello.this.notifyDestroyed();
}
};
}
public void startApp() {
Display.getDisplay(this).setCurrent(canvas);
}
public void pauseApp() {
}
public void destroyApp(boolean unc) {
}
}
Thanks,
Ricardo
- 16
- tricks in hibernate id selectionI see there are increment , identity or sequence , hilo or seqhilo
, assigned , foreign etc are identity selector in hibernate .
can anybody explain how to select an id out of this above list for
an application ?
|
| Author |
Message |
schnitzell

|
Posted: 2005-11-3 18:22:00 |
Top |
java-programmer, Where can I get java virtual machine of IBM ?
Hi guys,
I can't find java virtual machine of IBM.
Where can I get it ?
Please give me link.
Thanks.
Hans
|
| |
|
| |
 |
Ben_

|
Posted: 2005-11-3 20:28:00 |
Top |
java-programmer >> Where can I get java virtual machine of IBM ?
http://www-128.ibm.com/developerworks/java/jdk/
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- JWS consoleRoedy Green wrote:
> Is there a way to view the console or System.err with Java webstart
> apps?
>
File > Preferences > Advanced tab, then select "Show Java Console"
- Alistair
- 2
- Java String.replaceAll() not behaving as expectedGiven a string "s", I'd like to convert all the line separators into
their "escaped" string equivalents. i.e. a dos/windows newline gets
converted into the literal string "\r\n".
I tried this in my java code...
s = s.replaceAll("\n", "\\n");
s = s.replaceAll("\r", "\\r");
but I end up with "rn" instead of "\r\n"
I assume the problem has something to do with the regex pattern
replacement but it seems like it should work.
What am I doing wrong?
...
Krick
- 3
- Eclipse jboss toolsHi,
has been any efforts to ports jboss tools plugin for Eclipse?
It contains some parts written in C (i think having to do with GUI editors).
Using eclipse-devel 3.3.2 and jboss tools 2.1.1 (previously known as JBossIDE and
now commercially named as "Jboss developer studio).
Installing the jboss tools plugins from within eclipse, asis, results in a highly unstable eclipse
environment.
Any ideas?
--
Achilleas Mantzios
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 4
- Eclipse 2.1.1 does not save my workspaceHi,
Sometimes when I close out Eclipse 2.1.1, it doesn't say my worksapce
settings. Because of this, I cant find projects that I create prior
to this happening
Can anyone shed some light on this issue?
Thank You
- 5
- db connectionsGuys,
In a a stateful session bean I'm looking up a data source that wraps a
connection pool and using it to retrieve a connection.
How do I return the connection to the pool when I'm done? Is conn.close()
the right thing to do here?
If I just let it go out of scope I eventually get an exception in the pool
with an "out of resources" error.
- 6
- Run your own Auction Site, Pay per click directory, Google groups email harvestor, Email spider nowFree download full version , all products from Mewsoft dot com
http://netauction10.url4life.com/
Run your own Auction Site. Auction software for your site
----------------------------------------
Run your own auction site in minutes. Open source code in perl. Create
your own auction site in just a few minutes. NetAuction is the
complete auction package for every business from the personal to the
corporate business. SQL database backend for the highest scalability
and performance.
Directory, Pay per click search engine software
------------------------------------------------------------------
Open source code in perl. Build your own pay per click search engine
and build your entire sites in minutes with this software. NetEngine
is turn key Pay per click search engine and content management with
built in portal tools. SQL database backend for the highest
scalability and performance.
Groupawy
---------------
Google Groups Email collector. The first email spider for google
groups. Millions of valid and active emails in one easy location to
collect.
Spiderawy
---------------
Email spider machine. Multithreads and Multiplexed connections per
thread with built in database system for the highest scalability and
performance. Email and URL spider and extractor.
Site builder software
--------------------------------
Open source code in perl. Build and manage your sites with the fastest
browser based site builder and content management software ever.
NetBuilder is a complete package very easy to use for building your
sites online and offline with all the tools you ever need to manage
any site of any size.
Email list manager tools, free download full version
---------------------------------------------------------------------
Full Email lists tools suite. Email Extractor, Spider emails from
online web pages, Filter lists, Merge lists, Remove unsubscribe lists
from lists, Splitter to split larg email list file to smaller files,
Deduplicator to remove duplicated emails.
- 7
- Difficulty resizing window inside an AppletHi all,
I have a Java puzzle written as an applet that I've been working on. So far
I've never been able to figure out how to resize it from inside the applet
itself.
So I created a very elaborate HTML file, where I use JavaScript which:
1. queries the screen resolution and browser,
2. dynamically opens a window based on the values returned from (1),
3. dynamically writes the applet/object tag to that window also based on
(1).
I'd love to get rid of this complicated mess of html/js code and do it from
pure Java if I can. For one thing, having two page refreshes is slow for the
user. I've tried setSize() and setBounds from every component level I can
think of. There are never any errors but it never works either. I noticed
that resize() works from inside a JDialog, but not from JPanel. I'd be happy
to use a JDialog to hold the JPEG image, instead of JPanel, but that doesn't
seem to work.
Also, I'd love to be able to resize on the fly. Is it a big deal to trap the
window/resize event to allow the user to set the size?
I'd greatly appreciate any thoughts or ideas you may have.
Best regards,
Dave
- 8
- BoundingSphereHi all!
I have a little ask..how can i create a bounding sphere on a Sphere object.
Sphere gives me only the radius, how can i get the centre?
Andrea Todeschini
- 9
- 10
- how can write my servlet in weblogichai,
i new to weblogic environment.
i tryed the examples that are mentioned in sample directory of
weblogic.
i need for this purpose to start example server in order to see the out
put.
my question is how to write my own examples in my own directory and
execute them
instead of using sample server.
Thanks in advance.
- 11
- java.net.ServerSocket doesn't catch every connectionHi,
My problem is that ServerSocket.accept doesn't catch every connection
made to the socket.
I wrote a little server that gets a connection and spawns a new thread
giving the ServerSocket as parameter to the constructor. Then the
Thread is start()'ed.
The Code is:
ServerSocket serversock = new ServerSocket(port);
while (true) {
Socket socket = serversock.accept();
HandleSocket hs = new HandleSocket(socket);
hs.start();
}
But this code does not catch every connection that will be made to it
and I get a timeout with
the client application. If I retry connection it often works, but the
problem happens randomly.
I can't find anything, that could cause this problem. I'm really a bit
disappointed. I wrote the same application with C++ and had no
problems. But I need it platform independent, thats why I want to use
Java.
Anyone had this problem before? Can anyone help me?
Thanks in advance
- Michael
- 12
- Translator Tools? I was about to throw in the towel on this
project I've inherited. It's about 5,000
Java files, totally undocumented and uncommented.
I asked and looked for tools that would help
me make sense of this mess, so far to no avail.
Now the owner of the company is willing to
consider redoing it in C++. ( In my opinion
there was no good reason for the previous software
engineer to write this in Java. It's a pretty
straightforward Windows desktop app that would
be much easier to understand and maintain had
it been written in VC++. There's some evidence
he chose Java just so he could get some experience
with it,)
Anyhow, I'm not rewriting this by hand.
I came across the following in Bruce Eckel's
'Thinking In Java', "I've even heard it
suggested that you start with Java, to gain the
short development time, then use a tool and support
libraries to translate your code to C++, if
you need faster execution speed."
Has anybody heard of or better still used
such translator tools? Even if it only did
80-90% and the rest required manual intervention
it might work.
TIA for any advice.
Gerry Murphy
- 13
- Sending email in multiple languagesWe're trying to send out HTML emails in multiple languages
(English and Chinese (simplified and traditional)).
The subject as well as the body may contain multi-byte
characters.
We're having trouble making the email readable for all audiences.
Outlook (back to 2003)
On English computer
On Chinese computer
Hotmail
on IE with a chinese (simpl or trad) locale
on Firefox with a chinese (simpl or trad) locale
Yahoo mail
on IE with a chinese (simpl or trad) locale
on Firefox with a chinese (simpl or trad) locale
So far we're base64 encoding with a multipart doc type and
encoding with Big5 or GB1208 depending on the user's locale.
(UTF-8 didn't work very well).
Is there a mostly-universal way of doing this?
Tara
- 14
- jdk1.4.2 & fontsWe seem to be missing some fonts:
hal% ll /usr/local/jdk1.4.2/jre/lib/fonts/
total 2156
-rw-r--r-- 1 root wheel 75144 Nov 13 01:05 LucidaBrightDemiBold.ttf
-rw-r--r-- 1 root wheel 75124 Nov 13 01:05 LucidaBrightDemiItalic.ttf
-rw-r--r-- 1 root wheel 80856 Nov 13 01:05 LucidaBrightItalic.ttf
-rw-r--r-- 1 root wheel 344908 Nov 13 01:05 LucidaBrightRegular.ttf
-rw-r--r-- 1 root wheel 317896 Nov 13 01:05 LucidaSansDemiBold.ttf
-rw-r--r-- 1 root wheel 698236 Nov 13 01:05 LucidaSansRegular.ttf
-rw-r--r-- 1 root wheel 234068 Nov 13 01:05 LucidaTypewriterBold.ttf
-rw-r--r-- 1 root wheel 242700 Nov 13 01:05 LucidaTypewriterRegular.ttf
-rw-r--r-- 1 root wheel 6153 Nov 13 01:05 fonts.dir
hal% ll /usr/local/linux-sun-jdk1.4.2/jre/lib/fonts/
total 2716
-r--r--r-- 1 root wheel 75144 Aug 19 23:53 LucidaBrightDemiBold.ttf
-r--r--r-- 1 root wheel 75124 Aug 19 23:53 LucidaBrightDemiItalic.ttf
-r--r--r-- 1 root wheel 80856 Aug 19 23:53 LucidaBrightItalic.ttf
-r--r--r-- 1 root wheel 344908 Aug 19 23:53 LucidaBrightRegular.ttf
-r--r--r-- 1 root wheel 317896 Aug 19 23:53 LucidaSansDemiBold.ttf
-r--r--r-- 1 root wheel 91352 Aug 19 23:53 LucidaSansDemiOblique.ttf
-r--r--r-- 1 root wheel 253724 Aug 19 23:53 LucidaSansOblique.ttf
-r--r--r-- 1 root wheel 698236 Aug 19 23:53 LucidaSansRegular.ttf
-r--r--r-- 1 root wheel 234068 Aug 19 23:53 LucidaTypewriterBold.ttf
-r--r--r-- 1 root wheel 63168 Aug 19 23:53 LucidaTypewriterBoldOblique.ttf
-r--r--r-- 1 root wheel 137484 Aug 19 23:53 LucidaTypewriterOblique.ttf
-r--r--r-- 1 root wheel 242700 Aug 19 23:53 LucidaTypewriterRegular.ttf
-r--r--r-- 1 root wheel 6153 Aug 19 23:53 fonts.dir
--
Panagiotis Astithas
Electrical & Computer Engineer, PhD
Network Management Center
National Technical University of Athens, Greece
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 15
- [longish] Re: help errors[newbie]Madhur Ahuja <email***@***.com> wrote:
> Below is a simple program, which produces couple of errors.
> E:\programs\java1\concept\inner1.java:33: <identifier> expected
> t.somefunc(tt);
> ^
> E:\programs\java1\concept\inner1.java:33: package t does not exist
> t.somefunc(tt);
> ^
> 2 errors
>
> I cant seem to find the reason for these errors. Can anyone help
> me out.
Sure. Beware though, that I have a lot of remarks; also about coding
style and readability. It's a long read, but worth it (IMNSHO).
>
> public class inner1
- This name is confusing: it is an outer class with "inner" in the name...
- Please start class names with an upper case letter as in the JDK; when
most Java programmers read a name starting with a lowercase letter, they
expect a variable.
> {
>
> public static void main(String args[])
> {
> new test1();
> }
> }
This main method does nothing, unless you do everything in the
constructor. That is, your program runs when you create an object. This is
confusing.
>
>
> class test
> {
>
> private int a;
> test(int n)
> {
> a=n;
>
> }
This indentation is hard to read; you may use a bit more: 4 spaces or so.
If you run into the right margin, your code is most likely too complex.
Note that indentation, brace style, etc. is very personal, and has caused
many "holy wars" in the past. However, if it's readable, it's good.
Otherwise, it isn't. Opinions differ on what's readable though...
>
> void somefunc(test a)
> {
> a.a++;
> System.out.println(a.a);
> }
>
> }
>
> class test1
> {
> test t=new test(3);
> test tt=new test(4);
> t.somefunc(tt);
>
> }
This is the heart of the problem:
- t and tt are member variables, as they are defined outside any code
block.
- t.somefunc(tt) is a method call, but is outside a method, constructor or
even an initializer block. The compiler is expecting a definition for a
member variable, constructor, method or initializer.
You could make it work in several ways. Your goal is to understand why
option 2 is preferable.
Option 1:
- Double the braces in the definition of class test1. This creates an
initializer block that makes the lines inbetween into an anonymous
constructor that is always called when instantiating this class.
Option 2:
- Change the content of inner1#main(String[]) to:
test1 testObject = new test1();
testObject.callMethod();
- Perform the change of option 1.
- Between the two opening braces of the class test1, add this:
public void callMethod()
- Reformat the code (especially the class test1).
Regardless of which solution you choose, I advise you to read up on Sun's
coding conventions. Note they're just guidelines: you don't have to agree
with them. However, it helps if you follow them.
The URI is: http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html
Following them won't make you a better programmer, but it will help both
you and others to understand your code more easily. This in turn enables
you to get help more easily, and thus learn more.
--
Oscar Kind http://home.hccnet.nl/okind/
Software Developer for contact information, see website
PGP Key fingerprint: 91F3 6C72 F465 5E98 C246 61D9 2C32 8E24 097B B4E2
|
|
|