Is there a way to deal with line numbers in ImageJ and/or java?

A

academic

I'm new to java and don't know if this is a java question or an ImageJ
question.
BTW, Is there an ImagJ NG?


I try to compile some examples in ImageJ and it appears to be complaining
about the line numbers.

Is there a way to deal with line numbers in ImageJ and/or java?



Thanks
 
C

Chris Smith

academic said:
I'm new to java and don't know if this is a java question or an ImageJ
question.
BTW, Is there an ImagJ NG?

This is as good a group as any.
I try to compile some examples in ImageJ and it appears to be complaining
about the line numbers.

Is there a way to deal with line numbers in ImageJ and/or java?

In a Java source file, or in an ImageJ macro? Java doesn't have line
numbers, and I don't see any in ImageJ macros from the documentation on
their web site, either.

Perhaps you should post a simple example.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
T

Thomas Weidenfeller

academic said:
I'm new to java and don't know if this is a java question or an ImageJ
question.
BTW, Is there an ImagJ NG?


I try to compile some examples in ImageJ and it appears to be complaining
about the line numbers.

Is there a way to deal with line numbers in ImageJ and/or java?

A couple of things:

- Your question is so vague, that it is close to impossible to determine
what your problem is. We have to guess. Please consider
http://www.catb.org/~esr/faqs/smart-questions.html

- Beginner's questions are typically handled in comp.lang.java.help. But
this also doesn't excuse you from doing your own homework.

- A guess: If you try to compile Java source code with leading line
numbers, then there is something very wrong. Unlike languages like
classic BASIC, line numbers are not part of Java source code. You are
either trying to compile something which is not Java at all, or you
somehow managed to add some leading line numbers to some Java code.

- Another guess: The compiler complains about some error at a specific
line in your code. In this case examine your source code. Examine the
location the compiler pointed out! The compiler is in no way complaining
about the line number as such, but about an error in (or near) that
line, and the compiler is so helpful to tell you where it thinks things
go wrong. If you have such an error, people here need (a) the original,
complete, unaltered error message. Copyed'n'pasted directly into your
posting, not retyping it, and (b) the complete small source code. If
your code is not small, you need to write a small demo example which
still demonstrates the problem. Otherwise, we can only guess. We need
something to work with, and something which is so small, that we don't
have to waste time to peal out the real problem from a pile of code.

/Thomas
 
A

academic

I down loaded the below example and want to compile and run it to get a feel
for plugin coding.
It's named Inverter_.java

Thanks for being helpful

1 import ij.*;
2 import ij.plugin.filter.PlugInFilter; 3 import ij.process.*;
4 import java.awt.*;
5
6 /**
7 This example plugin filter inverts an Image that can
8 be in any of the four data types supported by ImageJ:
9 unsigned byte, unsigned short, float and RGB.
10 */
11
12 public class Inverter_ implements Plug.lnFilter {
13
14 public int setup(String arg, ImagePlus imp) {
15 if (arg.equals ("about"))
16 {showAbout(); return DONE;}
....snip
 
A

academic

Thomas Weidenfeller said:
A couple of things:

- Your question is so vague, that it is close to impossible to determine
what your problem is. We have to guess. Please consider
http://www.catb.org/~esr/faqs/smart-questions.html

- Beginner's questions are typically handled in comp.lang.java.help. But
this also doesn't excuse you from doing your own homework.

What are you assuming here?
- A guess: If you try to compile Java source code with leading line
numbers, then there is something very wrong. Unlike languages like classic
BASIC, line numbers are not part of Java source code. You are either
trying to compile something which is not Java at all, or you somehow
managed to add some leading line numbers to some Java code.

I down loaded an example. See my post to Chris
I'm sure I'm doing something wrong - that the reason for my question.
- Another guess: The compiler complains about some error at a specific
line in your code. In this case examine your source code. Examine the
location the compiler pointed out! The compiler is in no way complaining
about the line number as such, but about an error in (or near) that

I'm not sure I understand - the downloaded code does have line numbers so
if the compiler can't handle them why wouldn't it complain about them?

Thanks for replying
 
T

Thomas Hawtin

O

Oliver Wong

Not that I know of.
What are you assuming here?

Thomas is probably assuming that this is a beginner question, since you
opened your message with "I'm new to Java", and so basically he was saying
comp.lang.java.help is "more geared" to beginner questions than
comp.lang.java.programmer.
I down loaded an example. See my post to Chris
I'm sure I'm doing something wrong - that the reason for my question.


I'm not sure I understand - the downloaded code does have line numbers so
if the compiler can't handle them why wouldn't it complain about them?

Everything starting from "- Another guess:" doesn't apply to your
situation. It's just that your original question as phrased as to be
ambiguous as to what the actual problem was. Thomas was making some educated
guesses as to what problems you were having, thinking perhaps that your
compiler gave you a message with the key words "Error" and "line number",
and you had mistakenly assumed that it was complaining about the line number
itself, when actually what the compiler is saying that some (unspecified)
error is located on that specific line number. It turns out that this second
guess is wrong (based on your post to Chris).

As to "if the compiler can't handle them why wouldn't it complain about
them?", probably because it never occurred to the person who wrote compiler
to actually check and complain about line numbers. It's kind of like
sticking a celery in the CD-drive of your computer will probably cause it to
break, but the error message you see won't be "Error: You inserted a celery
into the CD drive". The computer can't handle celeries, but that doesn't
mean there will be an error message specifically tailored for that
situation.

- Oliver
 
A

academic

thanks for your input.
Chris answered my original question and knowing that java does not use line
numbers I was able to move on and will probably need different help soon.

thanks again
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top