Solved

Is there something like __LINE__ and __FILE__ in Java ?

Posted on 1998-07-28
1
694 Views
Last Modified: 2012-06-21
Is there anything in JAVA that is comparable to the __LINE__ and __FILE__ from C/C++ ?
thanks in advance!
0
Comment
Question by:jefftk99
1 Comment
 
LVL 4

Accepted Solution

by:
evijay earned 50 total points
ID: 1228771
You have to write a function which does the following -


Exception e = new Exception("dummy");
e.printStackTrace( a_print_stream);

here, a_print_stream is a PrintStream generated from a array of bytes or a custom print stream. The stack trace is sent to the print stream which you have to convert to chars, then, parse the function to get to the appropriate calling function details and print them

0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Timer (static) 9 43
session migration servlets 2 36
How do I remove an object from a 3 23
Facing this issue for maven proxy setting 2 9
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question