Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » How to debug with data from standard input?
How to debug with data from standard input? [message #243270] Sat, 15 December 2007 23:27
Eclipse UserFriend
Originally posted by: siegfried.heintze.com

I need to be able to pipe a spring configuration file into standard input.
So I have a simple spring program that works when it reads the input from a
file. The spring framework complains when I try to pipe the configuration
file from standard input.

How can I use eclipse to read my config file from standard input so I can
single step thru the spring source (assuming I can figure out how to attach
the spring source to the jar file) and get some clues as to how to alleviate
the problem?

Thanks,
Siegfried

/*
* Begin commands to execute this file using Java with bash
* if [ `uname` == 'Linux' ]
* then
* export CLASSPATH=build:.
* else
* export
CLASSPATH=build\;c\:\\dev\\spring\\spring-framework-2.5\\dis t\\*\;c\:\\dev\\spring\\spring-framework-2.5\\dist\\modules* \;\;c\:\\dev\\spring\\spring-framework-2.5\\lib\\jakarta-com mons\\*\;.
* fi
* if [ -e "build" ]
* then
* echo "already have build directory"
* else
* echo "mkdir build"
* mkdir build
* fi
* javac -g *.java -d build
* java com.springinaction.chapter01.hello.HelloApp
"/helloApp/datum[1]/value/text()" '/helloApp/datum[@name="abc"]' <<EOF
* <?xml version="1.0" encoding="UTF-8"?>
*
* <beans xmlns="http://www.springframework.org/schema/beans"
* xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
* xsi:schemaLocation="http://www.springframework.org/schema/beans
* http://www.springframework.org/schema/beans/spring-beans-2.0 .xsd">
* <beans>
* <bean id="greetingServiceSpanish"
* class="com.springinaction.chapter01.hello.GreetingServiceImpl ">
* <!--
* <property name="greeting" value="Buenos Dias!" />
* -->
* <property name="greeting">
* <value>Buenos Dias!</value>
* </property>
* </bean>
* <bean id="greetingServiceEnglish"
* class="com.springinaction.chapter01.hello.GreetingServiceImpl ">
* <property name="greeting">
* <value>Good Day!</value>
* </property>
* </bean>
* </beans>
* EOF
* rm build/com/springinaction/chapter01/hello/HelloApp.class
* End commands to execute this file using Java with bash
*
*/
package com.springinaction.chapter01.hello;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.FileSystemResource;
import org.springframework.core.io.InputStreamResource;

public class HelloApp {
static java.io.PrintStream out = System.out;
static java.io.BufferedReader in=new java.io.BufferedReader(new
java.io.InputStreamReader(System.in));
public static void main(String[] args) throws Exception {
//java.io.File dir = new java.io.File( /*"."*/
".\\sia2\\Chapter01\\Hello\\src\\main\\resources" );
//for(java.io.File f : dir.listFiles()) System.out.println(f.getPath());
//ClassPathResource cpr = new ClassPathResource("hello.xml"
/*".\\sia2\\Chapter01\\Hello\\src\\main\\resources\\hello.xml "*/);
//FileSystemResource fsr = new
FileSystemResource(".\\sia2\\Chapter01\\Hello\\src\\main\\resources\\hello.xml ");
InputStreamResource isr = new InputStreamResource(System.in,
"description goes here");
BeanFactory factory = new XmlBeanFactory( isr /* fsr*/ /*cpr*/ );
GreetingService greetingService = (GreetingService)
factory.getBean("greetingServiceEnglish");
greetingService.sayGreeting();
((GreetingService)
factory.getBean("greetingServiceSpanish")).sayGreeting();
}
}
Previous Topic:Launch debugger problem
Next Topic:crosspost from GMF : Installation -> 'wizards' missing
Goto Forum:
  


Current Time: Sat Nov 02 22:02:15 GMT 2024

Powered by FUDForum. Page generated in 0.07062 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top