source 1 « Development « Java I/O Q&A





1. How do I add an extra source directory that will be used by the maven-jxr-plugin?    stackoverflow.com

I'm using the build-helper-maven-plugin to add it to my build, but I'd like to see the XREF source for this extra source directory as well. FYI: maven-jxr-plugin - The JXR plugin produces ...

2. Can't paste Java source file into IntelliJ IDEA    stackoverflow.com

I recently moved to IntelliJ IDEA. And I need to add several files to one of the packages in my project. The problem is I couldn't paste these files into that package. ...

3. What is the best way to convert a java object to xml with open source apis    stackoverflow.com

I was wondering what the best or most widely used apis are to convert a java object to xml. I'm fairly new on the subject. Is there some sort of ...

4. Best Practice for comments in Java source files?    stackoverflow.com

This doesn't have to be Java, but it's what I'm dealing with. Also, not so much concerned with the methods and details of those, I'm wondering about the overall class file. What ...

5. Instrument java source files with System.out.println statements?    stackoverflow.com

I am looking for an easy way (say, a single script/batch file or a simple program) to instrument a set of Java source files so that each method has an added ...

6. Using selenium.getBodyText() to capture HTML source, using Java, how can I save it into a HTML file locally?    stackoverflow.com

This is probably a java noob question but here is my scenario:

  1. using selenium, I captured the html source with getBodyText()
  2. using java, I want to save the information from getBodyText() into a ...

7. is there any way to rearrange imports in java source file    stackoverflow.com

Is there an easy way to rearrange imports in all *.java files in a project? so for example:

import java.util.Calendar;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
would become
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
we have about 200 source files ...

8. How can I run unit tests for just the source files which have changed?    stackoverflow.com

Is there a way I can get ant to run the unit tests just for the java classes it builds? For example, if MyClass.java is out of date, ant will ...

9. Is there a sophisticated file system monitor for Java which is freeware or open source?    stackoverflow.com

I'm looking for a Java library which can notify me about changes on the file system. I found some free libraries, but they all use brute-force detection, i.e. polling in regular intervals. ...





10. Valid Keywords for Beginning a Java Source File    stackoverflow.com

So far I know that these keywords are valid for beginning a java source file: class, public, import, package, interface, and final Additions from comments: abstract, strictfp, enum Are there any more? (Thanks for ...

11. How to compile a java source file which is encoded as "UTF-8"?    stackoverflow.com

I saved my java source file specifying it's encoding type as UTF-8 (using notepad, by default notepad's encoding type is ANSI) then I tried to compile it using javac -encoding "UTF-8" ...

12. How to get surrounding method in Java source file for a given line number    stackoverflow.com

I have a line number of a Java source file and want to get the sourounding method for that line number programatically. I looked into ANTLR which didn't help me ...

13. Java - Reading input from a file. java.io.FilterInputStream.available(Unknown Source)?    stackoverflow.com

I haven't written any Java in years and I went back to refresh my memory with a simple 'read-from-file' example. Here is my code..

import java.io.*;
public class filereading {

   ...

14. What is a suitable lexer generator that I can use to strip identifiers from many language source files?    stackoverflow.com

I'm working on a group project for my University which is going to be used for plagiarism detection in Computer Science. My group is primarily going off the hashing/fingerprinting techniques described in ...

15. How do I compile my Java source files?    stackoverflow.com

My source files are in this folder: c:\data\mycompany. All of my source files contain the following as the first line: package mycompany; Now from the c:\data folder, I compiled everything using ...

16. creating a shared library from c++ source file    stackoverflow.com

when I tried to create a shared library file using the "cl" command in the vc++ command prompt, it shows a error saying "Can't open include file "jni.h": No such file ...





17. Remove source file comments using IntelliJ?    stackoverflow.com

Is there a plugin or tool in IntelliJ that will strip all comments out of your source .java files? I've read about an ANT task that can do this.. ...

18. Replace in Java Rhino (JSR223) with actual file name    stackoverflow.com

In my code, all of the scripts are contained in .js files. Whenever one of the scripts contains an error, I get this: javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "nonexistant" is not defined. (<Unknown source>#5) ...

19. How can I exclude my tests package from source folder in an ant build file?    stackoverflow.com

I have the following declaration in my build.xml file, in my src folder I have my test package which I don't want to include into my process. How can I force ...

20. What are the pro and cons of having localization files vs hard coded variables in source code?    stackoverflow.com

Definitions: Files: Having the localization phrases stored in a physical file that gets read at application start-up and the phrases are stored in the memory to be accessed via util-methods. The phrases are ...

21. Where can I obtain the Red5 SOSample Source File?    stackoverflow.com

I was hoping to procure the src for SOSample in Red 5 in order to better understand some of the commands they use within the demonstrations that us SOSample. Edit To Clarify the ...

22. Why do Java source files go into a directory structure?    stackoverflow.com

as weSuppose that I am creating a Java project with the following classes

  1. com.bharani.ClassOne
  2. com.bharani.ClassTwo
  3. com.bharani.helper.HelperOne
  4. com.bharani.helper.support.HelperTwo
with files put immediately under the folder 'src'
  1. src/ClassOne.java
  2. src/ClassTwo.java
  3. src/HelperOne.java
  4. src/HelperTwo.java
and compile them using the command
$ javac -d classes src/*.java ...

23. Java - Read a website and NOT the source    stackoverflow.com

OK so I redefined my last program... here it is:

import java.io.BufferedReader; 
import java.io.InputStreamReader;
import java.net.URL; 
import java.net.URLConnection;


public class asp {
    public static void main(String[] args) {
    ...

24. Editing a java source code file    stackoverflow.com

I am trying to edit a class by parsing it, adding some information to it and then writing it back. I was wondering if there is a tool (similar to something ...

25. Save a java source code to a file?    stackoverflow.com

I'm having a problem to save my java source code to a file, I want to prompt the user for the name of the java source file and then write java ...

26. Save a java source code to a file    stackoverflow.com

sorry folks I should've elaborated more, this is my problem: I have created a simple bean builder tool to allow users to add components like JLable or JButton or other components to ...

27. Is there any conceivable way in which a .java file could cause harm?    stackoverflow.com

Is there any way in which .java files on a web server, that are linked via a tag, could possibly, conceivably, cause damage anywhere -- on the server or client ...

28. Load file from source package    stackoverflow.com

I am trying to load a text file from the src package. I don't want to load it as an input stream. I would like to load it as an FileReader. Looking ...

29. Java will not compile properly from the command line "cannot find my source files"    stackoverflow.com

This has been frustrating me intensely. I am trying to compile my source code from the Windows 7 command prompt. I have added the directory in which my *.java file is located ...

30. Save File that is in source package    stackoverflow.com

I'm trying to save file directories so that when my app opens again the directories are remembered. I want to save the directories to a file called 'directories.txt' which is in ...

31. java split source files    stackoverflow.com

I am new to java and I have two classes (class calc and button) that I need to split into separate files and class calc uses class button. they both compile ...

32. Code generation from java source files    stackoverflow.com

I'm currently working on a Java/Flex project and I'm looking for a way to generate some parts of my Actionscript code from my Java files. One of the goal is to generate ...

33. Empty new line at the end of the java source files    stackoverflow.com

In my current project we always insert empty new line at the end of the java source files (it was enforced by project lead). We also enforce this with checkstyle (with ...

34. how to compile multiple java source files in command line    stackoverflow.com

I am new to java command line building. In eclipse, I just need to write the source in the sample project and the it builds automatically. I know javac file1.java -----> file1.class if ...

35. Browse JDK 7 source files (on the web)    stackoverflow.com

This might be a trivial question, but can anyone direct me to where the jdk 7 source is hosted? Thank you!

36. Open Source Tools to calculate Halstead Complexity metrics for Java file    stackoverflow.com

Are there any open source tools to calculate Halstead Complexity metrics for Java source files.

37. javac no source files found    stackoverflow.com

I have the .java file on the current working directory but javac reports

javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options
iam working on ubuntu

38. Desktop Sharing and Chat open source    stackoverflow.com

I need library or ready to use open source desktop sharing and chat application in C#, C++ or Java. I should use this in my project. I see real vnc is not ...

39. Identify the source line and/or file of a Java sentence?    stackoverflow.com

Is there a way to easily see where I am in code down the the line number without throwing an exception? That is, I have a circumstance in which it ...

40. Unresolved dependencies in the protocol buffer java source code    stackoverflow.com

I am trying to use Protocol buffers in my project(web-app) based in Java. I downloaded zip Protocol Buffers 2.4.0a full source(C++,Java,Python) & Protocol Buffers 2.4.0 compiler-Windows binary. I was ...

41. Most reliable open source Java library for converting PDF-files to bitmaps    stackoverflow.com

I have a situation where I want to convert user supplied single page PDF's to black and white bitmaps in a suitable high resolution for further processing (eventually ending in a ...

42. download some open source files from java.net site.... is it working? e.g timingframework & javacss    stackoverflow.com

I am trying to download some open source files from java.net site. Tried to get e.g. timing framework from there, and I am getting peculiar responses. are these files simply ...

43. Using Apache Ant APIs in Java program to programmatically build source files    stackoverflow.com

I am looking for good and practical resources that will help me use the Ant APIs effectively. The project website just gives the documentation of the API which is not useful ...

44. How do I import existing source files into JDeveloper?    stackoverflow.com

I am trying to create a project in JDeveloper and import several existing source trees into the project. I don't see any option within the interface for doing this. ...

45. need source code in java    stackoverflow.com

i need source code in java for a program that can scan the entire desktop data i.e. all files and folders and store it in some database . basically it should work ...

46. Pack200 source file    stackoverflow.com

I am looking for the source file for the pack200 utility usually located at /usr/bin/pack200 for openjdk. I have found the source for the java in the openjdk source but I ...

47. Need open source for file handling    stackoverflow.com

There are many file operations in my program, such as copy/move/delete files. Of course, I could use JDK java.io.File class to handle such operations, but I think there are must better ...

48. Error compiling report java source files    stackoverflow.com

my probleme is: i can't compile my report from java. well i create my page in iReport and i load it from my java code. here is some of my error:

   ...

49. Are there any open source projects for managing parallel asynchronous projects?    stackoverflow.com

I am currently working on a project where we need to distribute file processing across multiple machines in order to distribute load. Basically, we'll have an FTP server where files are ...

50. Can I have macros in Java source files    stackoverflow.com

In my program I'm reading integers form console many times. At every time , I need to type this line.

new Scanner(System.in).nextInt(); 
Hence like in c/c++, if I define a macro like
#define ...

51. Adding calendar source files in Java problem    stackoverflow.com

I am trying to create a calendar instance. I have imported the java.util.calendar but when I mouse over my code to create a calendar instance, it tells me that it cannot find ...

52. Why openfire source has >2800 files when other jabber implementations have <350    stackoverflow.com

I've recently downloaded sources of popular xmpp servers and discovered that java openfire implementation has more than 2800 files when c and erlang implementations jabberd 1.x, jabberd 2.x and ejabberd all ...

53. How to add a method source to an existing java file with JDT?    stackoverflow.com

I'm writing a simple eclipse plugin, which is a code generator. User can choose an existing method, then generate a new test method in corresponding test file, with JDT. Assume the test ...

54. How can I automate the reading of object properties from external sources (such as a file) in Java?    stackoverflow.com

I was wondering if there's some way which allows me to automate the updating of object properties from some source as a file or a map. To elaborate, suppose I have ...

55. How to make javac squawk for incorrect package names in Java source files    stackoverflow.com

Today, I ran into a java source file that had a typo in the 'package' statement at the top. The name of the package did not match the name of the ...

56. Running process builder attempting to execute "source" command    stackoverflow.com

I'm running process builder and trying to source /etc/profile to be able to execute commands that work in a regular shell.

String args[] = {"source", "/etc/profile"};
Process p = new ProcessBuilder(args).start();
InputStream is = ...

57. How to get surrounding method in Java source file for a given line number    stackoverflow.com

I have a line number of a Java source file and want to get the sourounding method for that line number programatically.

58. How to get source file-name/line-number from a java.lang.Class object    stackoverflow.com

Is it possible given a java.lang.Class instance to get the source file name and the line number at which the class has been declared? The data should be available in the ...

59. Empty file is a valid Java source file. How it is handled inside the JVM?    stackoverflow.com

Empty file is valid Java source file, but how it is handled inside the JVM?

60. Charset of Java source file and failing test    stackoverflow.com

First, I'd like to say that I've spent a lot of time searching for an explanation/solution. I've found hints of the problem, but no way to resolve my particular issue. ...

61. Regarding File Copy and make data & time same as source file    coderanch.com

I am trying to copy file on network pc's. and I want date & time of copied file same as source file. I am setting file date & time using file class. *********************************** File sfile=new File(); File dfile=new File(); dfile.setLastmodified(sfile.getLastmodified()); ************************************ But sometime I am getting date & time of copied file different than the source file. Plz help me to ...

63. which is third-party open source api good for file read/parse ?    coderanch.com

which is third-party open source api good for file read/parse ? Say, I have flat txt data file, I want to read it, parse it and then save it into database . Which third-party open source project is best ? I have searched Sourceforge, found a lot, but don't which one is good. Please share your experience. Thanks.

64. Compiling java source files stored in memory.    coderanch.com

Hi, Our application has a translator that creates some java source files based on the user's input. These files will be at our client's development environment and contain some valuable information about our application. We are not comfortable with this situation. (These java source files will be converted to .class files etc..) Is it possible to do any one of the ...

65. question about : adding a method to a valid java source file    coderanch.com

Currently I'm working on a new open source project that needs the following feature : add a property, method or class to a given valid java source file in a neat way. This should be done before and there should be dozens of projects that use this feature. But each and every project, like elide and qdox, have some problems with ...

66. How to parse a Java source file    coderanch.com

Welcome to JavaRanch. If you need to work with source files, then all the major Java parser generators (Antlr, SableCC, JavaCC) have grammars for Java source code. It shouldn't be too hard to use those to get the information you're looking for. If you could somehow use class files this becomes much easier, because java.lang.Class has an API to tell you ...

67. copying files from Visual Source safe    coderanch.com

68. source files    coderanch.com

70. Java source file documentation header    coderanch.com

/* * Copyright 2006 (C) * * Created on : dd-mm-yy * Author : author * *----------------------------------------------------------------------------- * Revision History (Release 1.0.0.0) *----------------------------------------------------------------------------- * VERSION AUTHOR/ DESCRIPTION OF CHANGE * OLD/NEW DATE RFC NO *----------------------------------------------------------------------------- * --/1.0 | author | Initial Create. * | dd-mm-yy | *---------|---------------|--------------------------------------------------- * | author | Defect ID 1/Description * | dd-mm-yy | *---------|---------------|--------------------------------------------------- ...

71. Parsing Java Source Code Files    coderanch.com

I'm writing a tool in Java that will generate API documentation similar to Javadoc, but without the requirement for special tags or comments in the source code file. The result will be professional looking API documentation without cluttered source code. I would like to build my tool with some existing code that parses a java source code file and provides methods ...

72. To Check the Source file    coderanch.com

hii Friends, Here I want to know that ; suppose i have .java file and after compilation class file is generated for .java file In this case suppose i want to check that whether java file is changed after compilation, I know that there is command for java Interpreter but i forget it if anyone is aware of that please reply ...

73. SOURCE FILES ARE NOT .JAVA FILES    coderanch.com

Make sure, when you're saving a file in Notepad, that the "File type" dropdown box is set to "All Files." If it's set to ".txt" files, I believe your file will be named "YourFile.java.txt". If you set that drop down to "All Files," I believe you can avoid this problem. Of course, there are other editors out there that are much ...

74. Open source remote file backup idea...    coderanch.com

I'm not sure where to post this project idea, so I'll start here. A gentlman that I know wants to backup his fileserver from his business to a server offsite daily. The files on the remote server can stay zipped as long as we don't have to restore them. When restoring, the file must be unzipped again. Beside security, and maybe ...

75. Finding the packages for a source file    coderanch.com

Originally posted by Alex Jacobsen: If I have the name for a source file as a string, and I want to find all the packages used by that source file, how would I go about doing it within the program? Assuming the source file is in the same directory as the program.

76. Do I need to delete source files ?    coderanch.com

Hi, A very simple example: In current directory ~home/Desktop/A.java package com.one; public class A { public static void main(String[] args) { boolean assertions=false; assert assertions=true; System.out.println("com.one.A:"+assertions); } } In current directory ~home/Desktop/B.java package com.two; public class B { public static void main(String[] args) { boolean assertions=false; assert assertions=true; System.out.println("com.two.B:"+assertions); } } In current directory ~home/Desktop/Bee.java import com.one.*; import com.two.*; public class ...

77. The Source file    coderanch.com

That's not true. Two public top-level classes cannot be in the same file. And, if there is a public top-level class, then the file must have the same name as the class. The simple reason is "because that's what the Java Language Specification says". In my view, it is not particularly beneficial for beginners to try to analyse every decision the ...

78. Compiling and running two source files    coderanch.com

Hello everyone! I'm having some problems understanding how to use packages. I'd really appreciate any help you could provide. I have two source files (Meaty.java, Classy.java) in directories like this: C:\ ---Java_Programs -------com ----------test --------------Meaty.java --------------Classy.java where Meaty calls Classy in its constructor Here are the source files: //Classy.java------------------------------- package com.test; public class Classy { public Classy() { System.out.println("You've got class!"); ...

79. compile the source file    coderanch.com

80. source file intervisibility...    coderanch.com

Hi all, I have two source files (.java and all) in the same folder, and when I try to compile the one containing main(), it screeches to a halt declaring itself unable to recognize a symbol, which is the name of a method which is declared in the other source file. I've tried setting the CLASSPATH, including the name of the ...

81. How to build an existing project from source files.    coderanch.com

So, I have got an assignment from university, to choose a project from www.sourceforge.net and build/compile/run it. The problem is that after I download the source files, I do not now on which one I need to run javac from the command line, so that I compile the whole project. There are hundreds of java files, and most projects do not ...

82. File Upload is Not Finding Source File    coderanch.com

I am trying to use the following servlet to upload a file from client to server folder. This works when I am testing in development environment and running a local application server. However, when I move it to the production app server I get an error message that the source file cannot be found. It is like the servlet is looking ...

83. source code file    coderanch.com

84. View complete page source    coderanch.com

folks , I want to write an application which can give me a complete page source for a given URL , considering that the URL has search parameter (ex .http://www.nextag.com/camera/search-html). I tried using URL class but its still not giving me a complete page source. I actually want to perform page scrapping but not able to get complete page source . ...

85. Need suggestions to read the value of some HTML tags from its source    coderanch.com

I think a XSLT transformation would be the obvious tool to modify some contents of a HTML document. If you need to do it in Java maybe you could use an existing HTML parser (with JTidy you could work with a DOM tree, at least I've read something about it ; - )

86. Java cant find source file    coderanch.com

87. error in the source file    coderanch.com

88. Is there a tool to get source file list?    coderanch.com

I am looking for a tool (preferably open source) that would return a list of files used in Java application by providing it with main class (java source file not class file) and class paths. It is supposed to parse import and package instructions. If this tools would take maven project file (pom.xml) as an input it would be fantastic. Anyone ...

89. serializing an object to the same source package    java-forums.org

hey thanks, but i want to write and read from that xml file during the execution of the jar file. When i insert it in the project folder it didn't work. Thatz why i thought putting it in the source package will work and accessible through the jar file. Or is there any other way to access a database which can ...

90. Folders to group source files    java-forums.org

Thought that might be the case :(. Will that mean that they wont be displayed as a tree/hierarchy in the "Package Explorer" of eclipse? The current packages I have don't seem to display that way and it would make things a little less readable if I can't see the hierarchy at a glance :(. C++ spoiled me rotten with all it's ...

91. Get source code from java file    java-forums.org

92. How to Run four source file in a single package    java-forums.org

Hi ALL, Have some doubt.... I have 4 java file in a single package name called p1. Protection.java, Derived.java, SamePackage.java, Demo.java Bellow is the details... Protection.java ============== package p1; public class Protection { int n = 1; private int n_pri = 2; protected int n_pro = 3; public int n_pub = 4; public Protection() { System.out.println("base constructor"); System.out.println("n = " + ...

94. Errors with JDK source file    forums.oracle.com

I'm extremely new to JAVA. I just installed JDK 6 and JRE on Windows XP and typed java ~version at the command prompt and got this error: Exception in thread "main" java.lang.NoClassDefFoundError: ~version caused by: java.lang.ClassNotFoundException: ~version at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) Can anyone please ...

95. Stuck with compiling a source file    forums.oracle.com

Hi, I'm stuck with this strange problem and i desperately need some help. My source file is in the D drive inside the package named objectwrite. The source file X.java is extending an abstract class named Y. When i'm trying to compile the files using the command javac objectwrite\ x.java y.java from D drive, it's giving the follopwing error javac: invalid ...

96. FLAT FILE SOURCE CODE    forums.oracle.com

97. source file    forums.oracle.com

************************************************************ Sun Microsystems, Inc. ("Sun") ENTITLEMENT for SOFTWARE Licensee/Company: Entity receiving Software. Effective Date: Date of delivery of the Software to You. Software: Java Platform, Enterprise Edition 5 SDK Update 1, which includes the following: Sun Java System Application Server Platform Edition 9 UR1, (ii) Project Open ESB Starter Kit, (iii) Java Platform, Enterprise Edition 5 Samples, (iv) Java BluePrints, (v) ...

98. I want to see the .java files (i mean source code of the java files)    forums.oracle.com

Hi, I have installed the weblogic server like following:- C:\bea\user_projects\domains\working_domain. Then i have deployed my application into the above domain. I want to see the .java files (i mean source code of the java files that i have written). is it possible to see the .java files from the above folder. I am having the same doubt in Wepshere as well. ...

99. Using File I/O to Reformat Java Source Code    forums.oracle.com

@abillconsl Thanks for the help. Yes, the call did return the system default delimiter. I wanted to change the Scanner delimiter to a carriage return to ensure that all my tokens are delimited by carriage returns. Next, I wanted to check all tokens for instances of carriage returns followed by an open bracket and change them into simple whitespace followed by ...

100. repeating same import statement in different source files    forums.oracle.com

referring to your statement above i would like to give u an example, for example we are implementing log in our stand alone application. It requires every java program to import log api (at least 4 import statement in every java program). I don't think in this case its a design pattern. This is one good example i felt repeating of ...